This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the GCJ project. See the GCJ home page for more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
>>>>> "Godmar" == Godmar Back <gback@cs.utah.edu> writes: Godmar> I think he said that the way to bend the rules is to create Godmar> "active uses" before invoking main(). The JLS spec supposedly Godmar> leaves open what is done before main(). Hence, one could Godmar> insert code that uses non-constant static fields. Or, you Godmar> could have your JNI driver first invoke a Class.forName(, Godmar> true) for all classes you're interested in before it invokes Godmar> main(). Yikes. That's not safe. Some developers rely on static initializers, and this specified behavior of "immediately before" to manage resource allocation "just in time". This could cause problems if all static initializers were blindly run at launch time. For example, what if I had two classes that were designed to be used individually, based on information only available through discovery at runtime. If each class was designed to assume that it was going to be run exclusively of the other (based on the specified behavior of the jls), running static initialization on both at launch time would cause problems. On the other extreme, having no initialization except through a JNI driver (which is an interesting idea) means extra work for the developer to deploy this solution on your platform -vs- others. -jvp