RFR: 8268873: Unnecessary Vector usage in java.base

Michael Bien github.com+114367+mbien at openjdk.java.net
Wed Jun 16 09:22:48 UTC 2021


On Mon, 14 Jun 2021 11:34:50 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:

> Usage of thread-safe collection `Vector` is unnecessary. It's recommended to use `ArrayList` if a thread-safe implementation is not needed.
> I checked only places where `Vector` was used as local variable.

src/java.base/share/classes/sun/security/pkcs/PKCS7.java line 592:

> 590: 
> 591:             SignerInfo[] result = new SignerInfo[intResult.size()];
> 592:             return intResult.toArray(result);

could be simplified to
`return intResult.toArray(new SignerInfo[0]);`
which would eliminate array zeroing as bonus as I have learned from your other PR ;)

-------------

PR: https://git.openjdk.java.net/jdk/pull/4482



More information about the security-dev mailing list