On Wed, 26 Feb 2025 16:59:39 GMT, Jorn Vernee <jver...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/invoke/VarForm.java line 150:
>> 
>>> 148:         String methodName = value.methodName();
>>> 149:         MethodType type = 
>>> methodType_table[value.at.ordinal()].insertParameterTypes(0, 
>>> VarHandle.class);
>>> 150:         assert !UNSAFE.shouldBeInitialized(implClass) : implClass;
>> 
>> Thanks - took a long time to figure this one out -- hopefully it will save 
>> time in the future ;-)
>
> TBH, I thought that resolving the member name would implicitly initialize the 
> class

I think the lack of initialization is WAI - DMH explicitly has an 
initialization barrier form. This form requires the invoked static method to be 
resolved, yet it does not initialize the declaring class until the 
initialization barrier.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23720#discussion_r1971991806

Reply via email to