Warren Levy wrote:
>
> This allows me to get the serialVersionUID right (well, mostly right from
> what I'm seeing) in libgcj. If folks aren't getting the right values in
> Classpath, then I probably need to do it there too. Let me know if you
> agree.
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 :)
One thing I noticed is that JDK1.1 doesn't return "protected" members in
getFields/getMethods. Protected members are, of course, vital for
calculating the svuid. If you're getting results that are right most of
the time, it might be worth checking whether gcj is doing the same
thing...
Other problems that I had causing me to get wrong values were (1)
completely forgetting that I needed to check a serialVersionUID field if
it existed, and (2) assuming it had to be *private* static final -
actually it just has to be static final. 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...
HTH,
Stuart.