This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Static initializer bug
- To: java-discuss AT sourceware.cygnus dot com
- Subject: Static initializer bug
- From: Geoff Berry <gcb AT cs.duke dot edu>
- Date: 16 Sep 1999 01:49:23 -0400
I'm working on getting serialization working, and I came across the
following bug. Calling main in the following class prints 0:
class test
{
public static void main (String[] args)
{
System.out.println (i);
}
private static final int i;
static
{
i = 17;
}
}
My guess is that this is a gcj problem, since gcj -C generates the
following code:
Method name:7="<clinit>" static Signature: 8=()void
Attribute "Code", length:13, max_stack:0, max_locals:0, code_length:1
0: return
Method name:13="main" public static Signature: 14=(java.lang.String[])void
Attribute "Code", length:34, max_stack:2, max_locals:1, code_length:10
0: getstatic #20=<Field java.lang.System.out java.io.PrintStream>
3: getstatic #22=<Field test.i int>
6: invokevirtual #28=<Method java.io.PrintStream.println (int)void>
9: return
This was generated by the egcs_latest_snapshot revision from CVS.
Should I sumbit a PR for this?
--
Geoff Berry