> > 2. Does JVM specification allows an instance is created before finishing its > > class initialization? > > Yes: you can create an instance of a class during the initialization > of that class. > > You can't create one until after verification, however.
The description in Section 12.4.1 of http://java.sun.com/docs/books/jls/second_edition/html/execution.doc.html says: "A class or interface type T will be initialized immediately before the first occurrence of any one of the following: * T is a class and an instance of T is created. * T is a class and a static method declared by T is invoked. * A static field declared by T is assigned. * A static field declared by T is used and the reference to the field is not a compile-time constant (ยง15.28). References to compile-time constants must be resolved at compile time to a copy of the compile- time constant value, so uses of such a field never cause initialization. " This seems to imply an instance can only be created after the class initialization is completed. --~--~---------~--~----~------------~-------~--~----~ unsubscribe: [email protected] website: http://groups.google.com/group/android-porting -~----------~----~----~----~------~----~------~--~---
