RFR: 8366178: Implement JEP 526: Lazy Constants (Second Preview) [v26]
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Nov 17 11:19:15 UTC 2025
On Mon, 17 Nov 2025 09:32:02 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 with a new target base due to a merge or a rebase. The pull request now contains 125 commits:
>
> - Merge branch 'master' into lazy-constants
> - Merge master
> - Fix tests and improve docs
> - Remove inner classes in LazyList
> - Fix TOC TOU issue
> - Improve documentation for List and Map factories
> - Improve doc details
> - Improve text for hashCode()
> - Refine text about reachabilit of the contents
> - Align doc links for get()
> - ... and 115 more: https://git.openjdk.org/jdk/compare/69e30244...3c26e095
src/java.base/share/classes/java/lang/LazyConstant.java line 244:
> 242: * <p>
> 243: * In other words, equals compares the identity of this lazy constant and {@code obj}
> 244: * to determine equality. Hence, two lazy constant with the same contents are
Suggestion:
* to determine equality. Hence, two lazy constants with the same contents are
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27605#discussion_r2533674027
More information about the nio-dev
mailing list