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

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Mar 13 15:52:16 UTC 2025


On Thu, 13 Mar 2025 15:22:43 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Implement JEP 502.
>> 
>> The PR passes tier1-tier3 tests.
>
> Per Minborg has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 246 commits:
> 
>  - Merge branch 'master' into implement-jep502
>  - Clean up exception messages and fix comments
>  - Rename field
>  - Rename method and fix comment
>  - Rework reenterant logic
>  - Use acquire semantics for reading rather than volatile semantics
>  - Add missing null check
>  - Simplify handling of sentinel, wrap, and unwrap
>  - Fix JavaDoc issues
>  - Fix members in StableEnumFunction
>  - ... and 236 more: https://git.openjdk.org/jdk/compare/4e51a8c9...d6e1573f

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

> 43: 
> 44: /**
> 45:  * A stable value is a shallowly immutable holder of deferred content.

Is this terminology a leftover from previous JEP iterations? The JEP now says: 
>  stable values, which are objects that hold immutable data.

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

> 281:  * the {@code Foo} does not already exist.
> 282:  * <p>
> 283:  * Here is another example where a more complex dependency graph is created in which

I wonder if just leaving the fibonacci example would be enough here -- as that has a nice dependency graph

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

> 328:  * thread safe and guarantee at-most-once-per-input invocation.
> 329:  *
> 330:  * <h2 id="miscellaneous">Miscellaneous</h2>

I'm dubious about a section called "misc" :-)

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

> 329:  *
> 330:  * <h2 id="miscellaneous">Miscellaneous</h2>
> 331:  * Except for a StableValue's content itself, an {@linkplain #orElse(Object) orElse(other)}

missing `{@code}`

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

> 333:  * parameters must be <em>non-null</em> or a {@link NullPointerException} will be thrown.
> 334:  * <p>
> 335:  * Stable functions and collections are not {@link Serializable} as this would require

Not sure this belongs here. Perhaps the comment on these functions not being serializable should be on their factories. And the point on security vulnerability seems specific and vague at the same time -- better remove it.

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

> 337:  * which would introduce security vulnerabilities.
> 338:  * <p>
> 339:  * As objects can be set via stable values but never removed, this can be a source

It feels like this could probably be expanded upon -- also covering stable functions (and morphed into a new section)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r1993819611
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r1993803509
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r1993810862
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r1993805209
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r1993808888
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r1993812118


More information about the compiler-dev mailing list