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!
Other combinations of field modifiers with static seem to also cause bogus
serialVersionUID values. And I don't see any reason from the code or the
spec that making static fields final should make things "work" suddenly.
> Took me ages to find this bug,
> because when the errors are of the form of getting 1437831798324783
> instead of 569468459655654, there aren't many hints as to what you're
> doing wrong...
;-) I've already tracked down and fixed some obscure stuff in libgcj that
was affecting the generated values. Fortunately, I've been able to find
some clue that has eventually led me to the offending code each time;
unfortunately in this case, I haven't found that kind of clue yet. I
assume you don't have this kind of problem with static fields, right? If
you did at one time, what was the cause?
--warrenl