MethodHandles and class initialization

Dain Sundstrom dain at iq80.com
Thu Jul 19 19:04:39 PDT 2012


I have some code that tries to get the value of a static final field using a MethodHandle, and I find that the field is null because the class isn't initialized. Is calling a method handle supposed to cause a class to initialize (run the <clinit> method)?  

In a related question, what is the best way to force initialization and when do you do the initialization? in the bootstrap method?

BTW, this is on Java7 on OSX.

-dain


More information about the mlvm-dev mailing list