On Thu, 9 Apr 2026 12:11:15 GMT, Per Minborg <[email protected]> wrote:

>> Implement JEP 531: Lazy Constants (Third Preview)
>> 
>> This PR replaces _draft_ https://github.com/openjdk/jdk/pull/29507
>
> Per Minborg has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - Add additional test improvements
>  - Improve tests

src/java.base/share/classes/java/lang/LazyConstant.java line 46:

> 44: 
> 45: /**
> 46:  * A lazy constant is a holder of content that can be set at most once.

I wonder if we should change the word "set" to "initialized" - given we no 
longer support imperative setting.

src/java.base/share/classes/java/util/LazyCollections.java line 59:

> 57: 
> 58:     @jdk.internal.ValueBased
> 59:     static final class LazyList<E>

Consider using `@TrustFinalFields` on class instead of `@Stable` on final 
non-array fields.

src/java.base/share/classes/java/util/LazyCollections.java line 604:

> 602: 
> 603:         // Holds all the throwable-to-token mappings
> 604:         static final Map<Class<? extends Throwable>, Integer> TOKENS = 
> new ConcurrentHashMap<>();

This code doesn't consider that classes may be unloaded - consider using 
ReferencedKeyMap.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30194#discussion_r3058033480
PR Review Comment: https://git.openjdk.org/jdk/pull/30194#discussion_r3058071640
PR Review Comment: https://git.openjdk.org/jdk/pull/30194#discussion_r3058080932

Reply via email to