On 19/12/2013 9:59 PM, Alan Bateman wrote:
On 19/12/2013 10:13, David Holmes wrote:

Not necessarily. The question is, are there any code paths that lead
to checkInitted being called after  setOut0(newPrintStream(fdOut,
props.getProperty("sun.stdout.encoding"))) but before the call to
sun.misc.VM.booted(). If so these would fail under the proposed change.

The initialization sequence is fragile and intimately tied to the
Hotspot VM - ie the VM initialization process initiates the core class
initialization. In a "normal" initialization System is initialized
before Class and Class must be initialized before checkInitted can be
called, so this doesn't trigger initialization of System.

I also don't see how System.out being null can be valid
post-initialization state given the call to
setOut0(newPrintStream(fdOut, props.getProperty("sun.stdout.encoding")))
It would be unusual to change it later with System.setOut but it is
possible.

In any case, using VM.isBooted is the normal way to check if system
initialization has completed.

Yes but it may not be sufficient in this case. As I said we have to be sure checkInitted can not be called by anything between the setting of out to non-null and the call to booted().

David

-Alan.

Reply via email to