RFR: JDK-8297299 SequenceInputStream should not use Vector
Alan Bateman
alanb at openjdk.org
Sun Nov 20 07:59:17 UTC 2022
On Sat, 19 Nov 2022 21:36:56 GMT, Markus KARG <duke at openjdk.org> wrote:
> There is no need to use a temporary Vector within the constructor of SynchronizedInputStream, as more efficient (non-synchronized) alternative code (like List.of) will do the same in possibly less time. While the optimization is not dramatic, it still makes sense to replace Vector unless synchronization is really needed.
Jai is correct, this constructor appears to have tolerated null in the second parameter since JDK 1.0 so we need to proceed with care. The SIS constructor that takes an Enumeration is similar in that it only throws NPE if the first element is null, it probably should have taken a defensive copy but that can't be changed now as there may be lazy implementations in the wild that depend on existing behavior.
-------------
PR: https://git.openjdk.org/jdk/pull/11249
More information about the core-libs-dev
mailing list