Class file generated by "gcj -C" throws ClassFormatError

Pete Bevin moose@bestiary.com
Fri Jun 22 13:06:00 GMT 2001


> class bar {
> static long x = 0;
> public static void main(String[] args) {
> }
> }
> 
> The error is thrown if x is initialized with '0'.  The
> error is not thrown if x is initialized with '0L' or
> not at all.

Seems that the ConstantValue attribute for the field "x" is pointing to a
Constant_Integer, not a Constant_Long in the "x = 0" case.  Section 4.7.3 of
the vmspec specifies that it should match the field's type, not the
constant's.

How to fix?  Dunno yet, parse.y is probably missing a promote_type()
somewhere.

Pete.



More information about the Java mailing list