On the EagerInitialization VM flag

David Holmes david.holmes at oracle.com
Thu Dec 19 00:26:03 PST 2013

On 14/12/2013 7:56 AM, Krystal Mok wrote:
> Which is of course true, but not what I really cared about.
> I'm just curious of the history of what that flag tried to do, and then
> why didn't it work. Any pointers or hints would be appriciated.

Given its age it is hard to say why it wasn't removed at the time 
4292939 indicated. What it does is force class initialization at class 
loading time. This might have been seen as useful at some point but it 
violates the Java language semantics regarding when class initialization 
can occur (eager loading is allowed, eager initialization is not).

Given eager initialization is likely to break the carefully crafted 
class initialization sequence I don't really see its utility - hence the 
proposal to remove it.


> Thanks,
> Kris
> On Friday, December 13, 2013, Christian Thalinger wrote:
>     Well, it’s a develop flag so it cannot be used in the product anyway.
>     On Dec 13, 2013, at 11:27 AM, Krystal Mok <rednaxelafx at gmail.com
>     <javascript:_e({}, 'cvml', 'rednaxelafx at gmail.com');>> wrote:
>>     Hi all,
>>     Does anybody still remember the history behind the
>>     -XX:+EagerInitialization flag? It'd be great if someone still
>>     knows what the flag was for, and why it was to be removed.
>>     I saw this bug: https://bugs.openjdk.java.net/browse/JDK-4292939
>>     which stated that this flag was going away in "the next build",
>>     but now it's still in the code.
>>     Thanks,
>>     Kris

More information about the hotspot-runtime-dev mailing list