RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v40]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Apr 3 14:58:19 UTC 2025


On Thu, 3 Apr 2025 14:00:00 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Implement JEP 502.
>> 
>> The PR passes tier1-tier3 tests.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Make the sqrt example different

src/java.base/share/classes/java/lang/StableValue.java line 410:

> 408:  * semantics associated with {@code final} fields is too restrictive.
> 409:  * <p>
> 410:  * In JDK 24, {@code final} instance fields in records and hidden classes (such as classes

I suggest to drop this -- we normally don't reference to JDK versions in the javadoc.

Perhaps this para should say: 


The _content_ of a set stable value is treated as a constant by the JVM, provided that the reference to the stable value is also constant (e.g. in cases where the stable value itself is stored in a `static final` field). 

This means that, at least in some cases, access to the content of a stable value enjoys the same constant-folding optimizations that are available when accessing `static final` fields.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2027192344


More information about the core-libs-dev mailing list