This is the mail archive of the
java-prs@sourceware.cygnus.com
mailing list for the Java project.
Re: gcj/260: "Klass.class" expression should cause Klass to be initialized
- To: apbianco at cygnus dot com
- Subject: Re: gcj/260: "Klass.class" expression should cause Klass to be initialized
- From: Jeff Sturm <jsturm at sigma6 dot com>
- Date: 18 Jun 2000 15:16:00 -0000
- Cc: java-prs at sourceware dot cygnus dot com,
- Reply-To: Jeff Sturm <jsturm at sigma6 dot com>
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