RFR: 8355379: Annotate lazy fields in java.security @Stable [v4]

Per Minborg pminborg at openjdk.org
Tue Aug 5 08:03:12 UTC 2025


On Tue, 29 Jul 2025 23:07:45 GMT, Koushik Muthukrishnan Thirupattur <duke at openjdk.org> wrote:

>> Several classes in the `java.security` package lazily compute their hash value and store it in a field. These fields can typically be annotated with the `@Stable` annotation. Many of the current implementations are using -1 as a flag for not computed, this needs to be refactored away.
>> 
>> Here are some examples of such classes: PKCS12Attribute and URICertStoreParameters.
>
> Koushik Muthukrishnan Thirupattur has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - 8355379: Annotate lazy fields in java.security @Stable
>  - 8355379: Annotate lazy fields in java.security @Stable
>  - 8355379: Annotate lazy fields in java.security @Stable

src/java.base/share/classes/java/security/PKCS12Attribute.java line 50:

> 48:     private String value;
> 49:     private final byte[] encoded;
> 50: 

The fields `name`, `value`, and `encoded` can also be marked `@Stable` with appropriate changes (e.g., making the fields `final` and setting them to `null` in the constructor that only takes an array). I think we should do this under a separate issue.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25405#discussion_r2253482575


More information about the security-dev mailing list