On Tue, 9 Jun 2026 12:52:29 GMT, Alan Bateman <[email protected]> wrote:

>> Yes, in the [provisional strict fields JEP 
>> spec](https://cr.openjdk.org/~dlsmith/jep401/jep401-20260518/specs/strict-fields-jvms.html):
>> 
>>> Otherwise, execution of the class or interface initialization method, if 
>>> any, has completed normally. Check whether each strictly-initialized static 
>>> field declared by C has been set. If any such field has been left unset, 
>>> acquire LC, transition C to the erroneous state, notify all waiting 
>>> threads, release LC, and complete this procedure abruptly with an 
>>> IllegalStateException as the reason.
>
> Okay, I've walked through InstanceKlass::notify_strict_static_access and the 
> new checks in InstanceKlass::initialize_impl so I can see where some of this 
> is implemented.

One thing to mull over is its potential to surface, e.g. batty code in a class 
initializer using Field.get to read a strictly-initialized static field before 
it is set, and whether Field.get needs to specify the ISE.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31123#discussion_r3408433734

Reply via email to