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

ExE Boss duke at openjdk.org
Tue Nov 18 11:14:53 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], as the `@Stable` annotation is only available to the system domain class loaders (bootstrap and platform).

[^1]: Without making use of `-Xbootclasspath/a:…`.

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

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


More information about the nio-dev mailing list