problem with java.lang.Class.serialVersionUID

Godmar Back gback@cs.utah.edu
Thu Oct 28 15:19:00 GMT 1999


I noticed that java.lang.Class does not provide a serialVersionUID.
However, unless you'll want to match Sun's java.lang.Class one-to-one
in all its internal glory, you'll need one.

So I went ahead and added one:

--- /x/gback/libgcj/libjava/java/lang/Class.java        Mon Oct 18 19:49:29 1999
+++ java/lang/Class.java        Thu Oct 28 16:07:49 1999
@@ -28,6 +28,8 @@
 
 public final class Class implements Serializable
 {
+  private static final long serialVersionUID = 3206093459760846163L;
+
   public static native Class forName (String className)
     throws ClassNotFoundException;
   public native Class[] getClasses ();


However, when I now try to compile programs referring to java.lang.Class,
such as the following:

public class GCJBug
{
        Class _;
}

it fails with:

GCJBug.java:1: Internal compiler error in `make_class_data', at ../egcs/gcc/java/class.c:1164
Please submit a full bug report.
See <URL: http://www.gnu.org/software/gcc/faq.html#bugreport > for instructions.
gcj: Internal compiler error: program jc1 got fatal signal 11

This is with a snap that's a few days old.


>From what little I can tell, it appears as though the code in 
make_class_data assumes that java.lang.Class does not have any fields,
not even private static final fields:

class.c:1163:  START_RECORD_CONSTRUCTOR (cons, class_type_node);
class.c:1164:  PUSH_SUPER_VALUE (cons, temp);

where PUSH_SUPER_VALUE checks that DECL_NAME(TREE_CHAIN(cons)) == NULL_TREE
and aborts if not.

How do I fix this?

Thanks,

	- Godmar



More information about the Java mailing list