RFR: 8366178: Implement JEP 526: Lazy Constants (Second Preview) [v28]

Per Minborg pminborg at openjdk.org
Tue Nov 18 12:19:34 UTC 2025


On Mon, 17 Nov 2025 11:38:03 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Implement JEP 526: Lazy Constants (Second Preview)
>> 
>> The lazy list/map implementations are broken out from `ImmutableCollections` to a separate class.
>> 
>> The old benchmarks are not moved/renamed to allow comparison with previous releases.
>> 
>> `java.util.Optional` is updated so that its field is annotated with `@Stable`.  This is to allow `Optional` instances to be held in lazy constants and still provide constant folding.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix typo

> Wrt. replacing `StableValue` with a `VarHandle` access mode, that has the downside of the variable not being constant foldable[1](#user-content-fn-1-dd52c5569368829688622e7b8db815eb), as the `@Stable` annotation is only available to the system domain class loaders (bootstrap and platform).

We think we can solve that. Stay tuned.

I will integrate this PR now.

There are outstanding comments in this PR that I will address in a separate follow-up PR.

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

PR Comment: https://git.openjdk.org/jdk/pull/27605#issuecomment-3547354435
PR Comment: https://git.openjdk.org/jdk/pull/27605#issuecomment-3547357897


More information about the nio-dev mailing list