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

Alan Bateman alanb at openjdk.org
Fri Apr 25 06:32:15 UTC 2025


On Thu, 24 Apr 2025 10:37:59 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 public constuctor private

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

> 468:      * @param other to return if the contents is not set
> 469:      */
> 470:     T orElse(T other);

Just to note that JEP 506 is proposing to change ScopedValue.orElse to disallow null. A ScopedValue can be bound to null (e.g. usage in Subject API) so using orElse(null) is problematic. A orNull may be added later if needed. As a StableValue can hold null then it's similar and might be surprising to developers to have the two APIs be different here. Something to look at again after JEP 502 is integrated, I'm not suggesting changing anything in this PR of course.

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

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


More information about the core-libs-dev mailing list