--dry-run description enhancement

Mandy Chung mandy.chung at oracle.com
Tue Jul 12 08:18:07 UTC 2016

> On Jul 12, 2016, at 2:00 PM, Paul Benedict <pbenedict at apache.org> wrote:
> Mandy, perhaps there is a JVM technicality here I'm unfamiliar with. My understanding of loading a class has always been that it's coupled with running its static initializers.

Loading, linking, and initializing are separate parts specified in JVM spec section 5 [1].

A good reference is that 3-arg Class::forName takes an initialize parameter that specifies if the class initializer should be invoked after a class is loaded.

> So my inference was that the class does not get loaded into memory because the latter no longer occurs with --dry-run.

To be clear, -—dry-run initiaizes the VM, loads the main class but the main method is not invoked.  The main class’s <clinit> is not invoked.

[1] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html

More information about the core-libs-dev mailing list