RFR: JDK-8291509 Minor cleanup could be done in sun.security

Sean Mullan mullan at openjdk.org
Fri Aug 26 10:59:56 UTC 2022


On Thu, 25 Aug 2022 18:44:59 GMT, Mark Powers <mpowers at openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/jca/ProviderList.java line 679:
>> 
>>> 677:         private final String algorithm;
>>> 678:         private final String provider;
>>> 679:         private String[] alternateNames = null;
>> 
>> shouldn't this also be final?
>
> If I make alternateNames final, then IJ complains "cannot assign a value to final variable".
> If I make  it final and remove initialization, then make complains that alternateNames might not have been initialized.

I would make it final, and then assign it to null in a final else block after line 719.

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

PR: https://git.openjdk.org/jdk/pull/9972



More information about the security-dev mailing list