gcj/260: "Klass.class" expression should cause Klass to be initialized

Jeff Sturm jsturm@sigma6.com
Sun Jun 18 08:16:00 GMT 2000


The following reply was made to PR gcj/260; it has been noted by GNATS.

From: Jeff Sturm <jsturm@sigma6.com>
To: Bryce McKinlay <bryce@albatross.co.nz>
Cc: tromey@cygnus.com, apbianco@cygnus.com, java-gnats@sourceware.cygnus.com
Subject: Re: gcj/260: "Klass.class" expression should cause Klass to be 
 initialized
Date: Sun, 18 Jun 2000 10:58:38 -0400

 Bryce McKinlay wrote:
 > Oh, it does. IIRC the spec is pretty clear that Class.forName() will cause
 > initialization (and JDBC wouldn't work if it didn't).
 
 I've never found that anywhere in the JLS... is there a newer copy I
 don't have?  All I see is that vague explanation about "certain methods
 in java.lang.Class..."
 
 No matter, we clearly want to match Sun's behavior anyway.
 
 > If it also says somewhere that ".class" is equivalent to Class.forName(), 
 > then obviously ".class" should initialize as well.
 
 I don't know if they are intentionally equivalent, but javac supports
 the ".class" syntax by generating (indirectly) a call to
 Class.forName().
 
 Now, the PR also says "gij ClassInit" fails the test.  It turns out that
 libgcj's Class.forName() fails to perform initialization as well.  So
 the runtime must be patched along with gcj.
 
 --
 Jeff Sturm
 jeff.sturm@appnet.com


More information about the Java-prs mailing list