Static initializer bug
Geoff Berry
gcbATcs.duke.edu
Wed Sep 15 22:43:00 GMT 1999
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
More information about the Java
mailing list