RFR: 8268873: Unnecessary Vector usage in java.base
Andrey Turbanov
github.com+741251+turbanoff at openjdk.java.net
Wed Jun 16 09:22:49 UTC 2021
On Tue, 15 Jun 2021 16:05:06 GMT, Michael Bien <github.com+114367+mbien 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 ;)
I considered this, when I was preparing the patch. But decided to reduce scope of changes.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4482
More information about the security-dev
mailing list