commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <>
Subject Re: [math][proposal] Drop serialization from selected classes
Date Sun, 23 May 2004 18:42:41 GMT
> The Math API maintains no "transient" fields. However, we do have
> "private static" fields in many classes and it would eventually be wise
> to verify these are or are not properly handled during the serialization
> process. I've worked hard on the statistic packages and feel confident
> that I've address the state of its static fields appropriately.
To be clear, static fields are not stored in the serialized data, or altered
when an instance is created from serialized data.

> Serialization Id's are only necessary if you are going to have a
> concern with serializing across versions of the math library and want to
> be able to match similar classes in different versions. This is not
> something that I see happening allot, usually when I am serializing, I
> am deserializing using the same version of the library because my
> application is installed on all machines I'm running the simulation on.
As a reviewer, I would be content, not happy, if there was a clear statement
that the serialized format may change between versions of the library.
However, using an assigned serialVersionUID will greatly reduce the chance
of breakages and let the JDKs design really work.

> The benefit of letting the JVM generate the serialVersionUID's is that
> you don't need to update them every time you change something in your
> classes.
AFAIN this is incorrect. Although the serialVersionUID is generated based on
the methods and fields of the class it is in fact just a number. Simply
declaring every serializableVersionUID with the id of 1 would also work.

The key point is that you never change the serialVersionUID once you have
assigned it. The default tool simply provides a suitable number that is
unlikely to be duplicated in another class.

Thus, I would still encourage [math] to provide a serialVersionUID in every
serializable class.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message