I can make your gcj-compiled binaries much smaller.

Andrew Haley aph@redhat.com
Thu Jan 16 15:46:00 GMT 2003


Brian Jones writes:

 > I recently applied a patch from JRVM to Classpath that changes a
 > .class reference to a Class.forName() lookup so that it works with
 > their JVM; to me the two were essentially the same and it made no
 > difference.  The point I'm taking from this discussion is that the
 > .class syntax is helpful for static compilation and compile time
 > checking the referenced class name.  Should this then be a
 > preferred method for obtaining static references to classes within
 > the core library or is it a bad engineering practice?

Static references are a preferred method, if only on efficiency
grounds.

   static {
      try {
	resourceBundleClass = Class.forName("java.util.ResourceBundle");

is harder to understand than a simple

  ResourceBundle.class

and I don't understand why you want to do make such a change.

Andrew.



More information about the Java mailing list