Re: RFR: 8263561: Re-examine uses of LinkedList

2021-03-14 Thread Alan Bateman
On Sun, 14 Mar 2021 17:26:07 GMT, Alan Bateman wrote: >> Looks like it's never specified in JavaDoc which particular implementation >> of List is used in fields of affected classes, so it's quite odd to me that >> someone would rely on that when using reflection. But your point about >> backwa

Re: RFR: 8263560: Remove needless wrapping with BufferedInputStream [v3]

2021-03-14 Thread Sergey Bylokhov
On Sun, 14 Mar 2021 19:35:25 GMT, Сергей Цыпанов wrote: >> In some cases wrapping of `InputStream` with `BufferedInputStream` is >> redundant, e.g. in case the wrapped one is `ByteArrayOutputStream` which >> does not require any buffer having one within. >> >> Other cases are related to readi

Re: RFR: 8263560: Remove needless wrapping with BufferedInputStream [v3]

2021-03-14 Thread Phil Race
On Sun, 14 Mar 2021 19:35:25 GMT, Сергей Цыпанов wrote: >> In some cases wrapping of `InputStream` with `BufferedInputStream` is >> redundant, e.g. in case the wrapped one is `ByteArrayOutputStream` which >> does not require any buffer having one within. >> >> Other cases are related to readi

Re: RFR: 8263560: Remove needless wrapping with BufferedInputStream [v3]

2021-03-14 Thread Сергей Цыпанов
> In some cases wrapping of `InputStream` with `BufferedInputStream` is > redundant, e.g. in case the wrapped one is `ByteArrayOutputStream` which does > not require any buffer having one within. > > Other cases are related to reading either a byte or short `byte[]`: in both > cases `BufferedIn

Re: RFR: 8263560: Remove needless wrapping with BufferedInputStream [v3]

2021-03-14 Thread Сергей Цыпанов
On Sun, 14 Mar 2021 17:40:27 GMT, Alan Bateman wrote: >> It turned out, that with this latest update some of tier2_tools tests are >> failing, e.g. `JLinkNegativeTest`: >> test JLinkNegativeTest.testMalformedJmod(): failure >> java.lang.AssertionError: Output does not fit regexp: Error: >> java

Re: RFR: 8263561: Re-examine uses of LinkedList

2021-03-14 Thread Сергей Цыпанов
On Sun, 14 Mar 2021 17:26:07 GMT, Alan Bateman wrote: >> Looks like it's never specified in JavaDoc which particular implementation >> of List is used in fields of affected classes, so it's quite odd to me that >> someone would rely on that when using reflection. But your point about >> backwa

Re: RFR: 8263560: Remove needless wrapping with BufferedInputStream [v2]

2021-03-14 Thread Alan Bateman
On Sun, 14 Mar 2021 17:34:12 GMT, Сергей Цыпанов wrote: >> src/java.base/share/classes/jdk/internal/jmod/JmodFile.java line 58: >> >>> 56: byte[] magic = in.readNBytes(4); >>> 57: if (magic.length != 4) { >>> 58: throw new IOException("Header expected to

Re: RFR: 8263560: Remove needless wrapping with BufferedInputStream [v2]

2021-03-14 Thread Сергей Цыпанов
On Sun, 14 Mar 2021 11:16:13 GMT, Alan Bateman wrote: >> Сергей Цыпанов has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Revert usage of InputStream.readNBytes() > > src/java.base/share/classes/jdk/internal/jmod/JmodFile.java line 58: >

Re: RFR: 8263560: Remove needless wrapping with BufferedInputStream [v2]

2021-03-14 Thread Сергей Цыпанов
> In some cases wrapping of `InputStream` with `BufferedInputStream` is > redundant, e.g. in case the wrapped one is `ByteArrayOutputStream` which does > not require any buffer having one within. > > Other cases are related to reading either a byte or short `byte[]`: in both > cases `BufferedIn

Re: RFR: 8263561: Re-examine uses of LinkedList

2021-03-14 Thread Alan Bateman
On Sun, 14 Mar 2021 17:18:11 GMT, Сергей Цыпанов wrote: >> If that's the only use case, I recommend changing the return type to a >> deque, and replace the linked list with an array deque instead (as done >> elsewhere in this pr) > > Looks like it's never specified in JavaDoc which particular

Re: RFR: 8263561: Re-examine uses of LinkedList

2021-03-14 Thread Сергей Цыпанов
On Sun, 14 Mar 2021 15:02:03 GMT, liach wrote: >> src/java.base/share/classes/jdk/internal/loader/URLClassPath.java line 220: >> >>> 218: return Collections.emptyList(); >>> 219: } >>> 220: List result = new ArrayList<>(); >> >> We'd better be cautious about this re

Re: RFR: 8263561: Re-examine uses of LinkedList

2021-03-14 Thread liach
On Sun, 14 Mar 2021 14:58:11 GMT, Yi Yang wrote: >> The usage of `LinkedList` is senseless and can be replaced with either >> `ArrayList` or `ArrayDeque` which are both more compact and effective. >> >> jdk:tier1 and jdk:tier2 are both ok > > src/java.base/share/classes/jdk/internal/loader/URLC

RFR: 8263561: Re-examine uses of LinkedList

2021-03-14 Thread Сергей Цыпанов
The usage of `LinkedList` is senseless and can be replaced with either `ArrayList` or `ArrayDeque` which are both more compact and effective. jdk:tier1 and jdk:tier2 are both ok - Commit messages: - Remove remaining usages of LinkedList in java.base Changes: https://git.openjdk.ja

Re: RFR: 8263561: Re-examine uses of LinkedList

2021-03-14 Thread Yi Yang
On Fri, 26 Feb 2021 10:48:33 GMT, Сергей Цыпанов wrote: > The usage of `LinkedList` is senseless and can be replaced with either > `ArrayList` or `ArrayDeque` which are both more compact and effective. > > jdk:tier1 and jdk:tier2 are both ok src/java.base/share/classes/jdk/internal/loader/URL

Re: RFR: 8263561: Re-examine uses of LinkedList

2021-03-14 Thread Сергей Цыпанов
On Fri, 26 Feb 2021 15:32:57 GMT, liach wrote: > Are linked lists worse for addition even in cases where addition to array > list or deque requires resize and copying? i thought that's the advantage of > linked list. As far as I know `LinkedList` is always worse than `ArrayList` and discourag

Re: RFR: 8263561: Re-examine uses of LinkedList

2021-03-14 Thread liach
On Fri, 26 Feb 2021 10:48:33 GMT, Сергей Цыпанов wrote: > The usage of `LinkedList` is senseless and can be replaced with either > `ArrayList` or `ArrayDeque` which are both more compact and effective. > > jdk:tier1 and jdk:tier2 are both ok Are linked lists worse for addition even in cases w

RFR: 8263560: Remove needless wrapping with BufferedInputStream

2021-03-14 Thread Сергей Цыпанов
In some cases wrapping of `InputStream` with `BufferedInputStream` is redundant, e.g. in case the wrapped one is `ByteArrayOutputStream` which does not require any buffer having one within. Other cases are related to reading either a byte or short `byte[]`: in both cases `BufferedInputStream.fi

Re: RFR: 8263560: Remove needless wrapping with BufferedInputStream

2021-03-14 Thread Alan Bateman
On Sat, 13 Mar 2021 22:29:23 GMT, Сергей Цыпанов wrote: > In some cases wrapping of `InputStream` with `BufferedInputStream` is > redundant, e.g. in case the wrapped one is `ByteArrayOutputStream` which does > not require any buffer having one within. > > Other cases are related to reading ei

Re: RFR: 8263560: Remove needless wrapping with BufferedInputStream

2021-03-14 Thread Сергей Цыпанов
On Sun, 14 Mar 2021 07:51:24 GMT, Alan Bateman wrote: >> In some cases wrapping of `InputStream` with `BufferedInputStream` is >> redundant, e.g. in case the wrapped one is `ByteArrayOutputStream` which >> does not require any buffer having one within. >> >> Other cases are related to reading

Re: RFR: 8187450: JNI local refs exceeds capacity warning in NetworkInterface::getAll

2021-03-14 Thread Alan Bateman
On Fri, 12 Mar 2021 09:52:13 GMT, Jonathan Dowland wrote: > This is an adaptation of a patch originally written by Shafi Ahmad in > a comment on the JBS page but never submitted or merged. > > With -Xcheck:jni, the method java.net.NetworkInterface.getAll very > quickly breaches the default JNI l