RFR: 8315974: Make fields final in 'com.sun.crypto.provider' package

Valerie Peng valeriep at openjdk.org
Tue Oct 10 22:24:24 UTC 2023


On Thu, 24 Aug 2023 08:53:53 GMT, Andrey Turbanov <aturbanov 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/PBKDF2KeyImpl.java line 127:

> 125:         // Use the cleaner to zero the key when no longer referenced
> 126:         final byte[] k = this.key = key;
> 127:         final char[] p = this.passwd;

Now that `this.key` and `this.passwd` is final, we can get rid of the local final variables `k` and `p`, right?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15412#discussion_r1353495078



More information about the security-dev mailing list