United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4769060 : docs: no spec for serialVersionUID

Details
Type:
Bug
Submit Date:
2002-10-25
Status:
Resolved
Updated Date:
2003-08-18
Project Name:
JDK
Resolved Date:
2003-08-18
Component:
core-libs
OS:
solaris_8,generic
Sub-Component:
java.io:serialization
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
5.0 (tiger)

Related Reports
Duplicate:
Relates:

Sub Tasks

Description
There is no specification for the interface in which a serializable class
declares its own serial version UID.  Is there a particular name that must
be used for this variable?  Must it be static?  Must it be private?
Must it be final?  Must it be constant?  Does the user have a choice in
declaring its type?  How does this variable affect serialization?

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger

FIXED IN:
tiger

INTEGRATED IN:
tiger
tiger-b16


                                     
2004-06-14
EVALUATION

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.

###@###.### 2002-10-25


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.

###@###.### 2002-10-25

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.

###@###.### 2002-10-25
                                     
2002-10-25



Hardware and Software, Engineered to Work Together