On Jul 25, Warren Levy wrote:
> On Wed, 28 Jun 2000, Stuart Ballard wrote:
>
> > As part of my "port" of Japize to use jode.bytecode, I had to implement
> > getSerialVersionUID on one of jode's ClassInfo objects. To do this I did
> > a straight port of the Classpath version, although it was possible to
> > simplify it a bit because jode uses TypeSignatures natively. I get the
> > correct results for every serializable class that is part of JDK1.1.
> >
> > Admittedly, I'm not running under Classpath, but Classpath's code works
> > great under both JDK and Kaffe :)
>
> Hmm, maybe you can shed some light on an obscure problem I'm tracking
> down. With libgjc, I'm running the Classpath code which calculates the
> serialVersionUID (in java.io.ObjectStreamClass) and I've noticed one
> problem, static fields don't cause the correct serialVersionUID to be
> generated. From the spec, everything seems to be ok; even odder, if
> the field is made static final, then the serialVersionUID is ok!
Nonfinal static fields that are initialized and "static {...}" blocks
in the java code are compiled to a "<clinit>" constructor in bytecode.
To calculate the serialVersionUID, classpath has to know the presence
of this constructor. IIRC it uses a native methods for this, so
check if this works for libgcj.
Jochen