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

Per Minborg pminborg at openjdk.org
Wed Oct 22 07:51:30 UTC 2025


On Sat, 18 Oct 2025 01:04:37 GMT, ExE Boss <duke at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/LazyConstant.java line 161:
>> 
>>> 159:  * to a lazy constant or if there is a chain from a {@code static final} field -- via one
>>> 160:  * or more <em>trusted fields</em> (i.e., {@code static final} fields,
>>> 161:  * {@linkplain Record record} fields, lazy constants, lazy lists, lazy maps,
>> 
>> lazy constants and lazy lists/maps are not themselves "trusted final fields" (at least not yet), so not sure they belong here?
>
> The `@Stable` annotation makes fields with non‑`null` values into trusted fields when the class is loaded by a platform class loader.

There could be a chain: `static final` -> record component -> lazy list element -> record component, for example, and this would be a trusted chain. There are other constucts that could be in the chain as well and that are not mentioned (e.g. a `List.of()`) so perhaps we should do some change here. Easiest is to just remove the mention of lazy*.

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

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


More information about the nio-dev mailing list