This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: problem with java.lang.Class.serialVersionUID
- To: tromey at cygnus dot com (Tom Tromey)
- Subject: Re: problem with java.lang.Class.serialVersionUID
- From: Godmar Back <gback at cs dot utah dot edu>
- Date: Mon, 1 Nov 1999 09:14:52 -0700 (MST)
- Cc: gback at cs dot utah dot edu, java-discuss at sourceware dot cygnus dot com
>
> >>>>> "Godmar" == Godmar Back <gback@cs.utah.edu> writes:
>
> Godmar> I noticed that java.lang.Class does not provide a
> Godmar> serialVersionUID. However, unless you'll want to match Sun's
> Godmar> java.lang.Class one-to-one in all its internal glory, you'll
> Godmar> need one.
>
> I'm probably being dense, but why would we want to add this?
>
Because at some point you'll want to implement serialization.
Utilities such as "serialver java.lang.Class" should then report the
same result as Sun's. This can be accomplished either by making sure
the algorithm to compute serial version uids computes the same values---
which requires the internal structures to be the same---or by adding this
final variable, which preempts the computation. From looking at the
source, it seems as though serialization support hasn't been included
in libgcj.
> Godmar> However, when I now try to compile programs referring to
> Godmar> java.lang.Class, such as the following:
> Godmar> it fails [ ... ]
>
> The compiler doesn't like Class or Object to differ from its internal
> idea of how they look.
>
That's what I figured. I can definitely see why wrt instance variables.
- Godmar