RFR: 8315974: Make fields final in 'com.sun.crypto.provider' package
Andrey Turbanov
aturbanov at openjdk.org
Wed Oct 11 08:11:13 UTC 2023
On Tue, 10 Oct 2023 04:17:47 GMT, Valerie Peng <valeriep at openjdk.org> wrote:
>> A few classes in `com.sun.crypto.provider` package have non-final fields which could easily be marked `final`.
>
> src/java.base/share/classes/com/sun/crypto/provider/EncryptedPrivateKeyInfo.java line 1:
>
>> 1: /*
>
> Hmm, there is also sun/security/pkcs/EncryptedPrivateKeyInfo.java which seems to have the same API and provide the exact same functionality. Maybe we can remove this file and update the users of this class to use sun.security.pkcs.EncryptedPrivateKeyInfo instead.
Looks similar, yes. I think it's worth to create a separate improvement for it.
> src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 109:
>
>> 107: int tagLenBytes = DEFAULT_TAG_LEN;
>> 108: // Key size if the value is passed, in bytes.
>> 109: private final int keySize;
>
> Why not also mark the `blockCipher` as private final?
Good catch!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15412#discussion_r1354352969
PR Review Comment: https://git.openjdk.org/jdk/pull/15412#discussion_r1354354214
More information about the security-dev
mailing list