This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: problem with java.lang.Class.serialVersionUID


> 
> >>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]