On Wed, 3 Jun 2026 15:01:27 GMT, Chen Liang <[email protected]> wrote:

>> src/java.base/share/classes/jdk/internal/reflect/MethodHandleBooleanFieldAccessorImpl.java
>>  line 65:
>> 
>>> 63:                 return (boolean) getter.invokeExact(obj);
>>> 64:             }
>>> 65:         } catch 
>>> (IllegalArgumentException|IllegalStateException|NullPointerException e) {
>> 
>> Is this part of strict initialization to catch an attempt to read before 
>> initialized explicitly?
>
> 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.

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

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

Reply via email to