Re: Serial IDs

Date view Thread view Subject view Author view

From: Godmar Back (gback@cs.utah.edu)
Date: Tue Feb 16 1999 - 11:42:34 EST


Tim,

I assume you have looked at

http://www.javasoft.com/products/jdk/1.2/docs/guide/serialization/spec/serialTOC.doc.html

and specifically

http://www.javasoft.com/products/jdk/1.2/docs/guide/serialization/spec/class.doc4.html#4100

I think the problems come in like it was mentioned in that mail the other
day: by compilers introducing flags that screw up the computation
(remember that jikes makes all methods of a final class final for no
good reason), and it comes in because some compilers create static
initializers where others don't. For instance, a difference between
pizza and javac is that if you have a class

    class A {
        static int X = 0;
    }

one will create a static initializer, setting X to zero, and the other
won't (I forgot which would and which wouldn't.)

However, if you don't get the same value for *any* class, there's the
potential there's a problem in your algorithm. Otherwise, you should at least
be able to identify for which classes it failed.

In fact, I remember fixing serialVersionUID by tweaking the native
methods when we still used Sun's libraries and comparing it to the output
of Sun's serialVersionUID. I thought I'd gotten it right then (the
native part, that is).

Needless to say, if one of our classes is not written to spec and you
compare the serialVersionUID with a class from Sun that's written to spec,
the serialVersionUID must not be the same. In fact, this will give us
a rather easy way of detecting a certain degree of compliance.
We need a Perl script here.

        - Godmar

>
> So I've written the serial ID stuff - but naturally though following the
> spec I downloaded it doesn't actually produce the same answer. If
> anyone has a reference or two to the serial ID generation spec I'd like
> to see it (just to check what I'm doing makes any sense).
>
> Cheers
> Tim
>
> --
> Tim Wilkinson Tel: +1 510 704 1660
> Transvirtual Technologies, Inc., Fax: +1 510 704 1893
> Berkeley, CA, USA. Email: tim@transvirtual.com
>
>
>
>


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:58:09 EDT