On Fri, 24 Oct 2025 09:01:10 GMT, Per Minborg <[email protected]> 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:
> 
>   Rework toString implementations

src/java.base/share/classes/java/util/List.java line 1200:

> 1198: 
> 1199:     /**
> 1200:      * {@return a new lazily computed list with the provided {@code 
> size}}

A minor comment here is that  "of the given size" might be a bit clearer than 
"with the provided size".

src/java.base/share/classes/java/util/List.java line 1240:

> 1238:      * function used to compute elements only so long as there are 
> uncomputed elements
> 1239:      * after which the computing function is not strongly referenced
> 1240:      * anymore and may be collected.

I think it's okay to say that the computing function is kept strongly reachable 
until at least all elements have been computed. I'm less sure about the second 
part being normative text and wonder if it would be better to move that part to 
an implNote.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27605#discussion_r2479172995
PR Review Comment: https://git.openjdk.org/jdk/pull/27605#discussion_r2479168408

Reply via email to