unreflectGetter and static class initialization

Jochen Theodorou blackdrag at gmx.org
Wed Oct 24 12:16:47 PDT 2012


Hi,

while working routing property access in Groovy through invokedynamic I 
stumbled upon one confusing part... If I have a static field and use 
Lookup#unreflectGetter to get a handle and then execute that handle, 
then it seems as if the class containing that field is not initialized. 
If I first get the field value, it is of course initialized and 
everything works as it should.

I have for example a final static field INSTANCE, initialized in cinit 
with a value. If I use the handle only, then INSTANCE will be null.

Now... is that really as it should be? Is that a known bug of 
1.7.0_06-ea-b10 and fixed in a later version?

bye Jochen


More information about the mlvm-dev mailing list