The serialVersionUID field and its requirements are specified in section
4.6 ("Stream Unique Identifiers") of the Java Object Serialization
specification. It would make sense to include some of this information,
or at least a pointer to it, in the javadoc for the Serializable interface
in a future release. Note that the javadoc for the various serialization
classes, however, is not intended to be a general specification of
serialization--there are numerous other aspects of serialization behavior that
are described only in the serialization spec and not in javadoc.
I read that section. The only text that even mentions serialVersionUID is
Each versioned class must identify the original class version for which it is
capable of writing streams and from which it can read. For example, a versioned
class must declare:
private static final long serialVersionUID = 3487495895819393L;
The stream-unique identifier is a 64-bit hash of the class name, interface class
names, methods, and fields. The value must be declared in all versions of a
class except the first. It may be declared in the original class but is not
required. The value is fixed for all compatible classes. If the SUID is not
declared for a class, the value defaults to the hash for that class.
Serializable classes do not need to anticipate versioning; however,
Externalizable classes do.
Note that because this is only an "example," this text does not answer any of the questions raised in this bug report.
Right, the serialization spec itself should be clarified as well, though
this will have to wait for a release after mantis due to resource constraints.