United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6253903 : Serialized Form javadoc for JMX API should list serialVersionUID of all serializable classes

Details
Type:
Bug
Submit Date:
2005-04-12
Status:
Closed
Updated Date:
2010-07-29
Project Name:
JDK
Resolved Date:
2005-12-03
Component:
core-svc
OS:
generic,solaris_2.6
Sub-Component:
javax.management
CPU:
generic,sparc
Priority:
P3
Resolution:
Fixed
Affected Versions:
5.0,6
Fixed Versions:

Related Reports
Duplicate:
Relates:
Relates:
Relates:

Sub Tasks

Description
Version 1.0 of the JMX API did not explicitly specify the serial form of all classes, and this form was essentially incorrect for certain classes.  Version 1.1 of the API rectified this by defining the serial form explicitly for all classes.  At this time code was introduced to allow continued serial interoperation with the 1.0 classes if a system property is specified.  The serialVersionUID of the relevant classes is different when the property is present than when it is absent.  Since the serialVersionUID is not a compile-time constant, it does not appear in the Javadoc output for these classes.  The classes should be augmented with appropriate @serial tags so that the correct serialVersionUID appears in the documentation.  Otherwise compatible implementations need to analyse the Reference Implementation (e.g. with the serialver tool) in order to determine the correct value.
###@###.### 2005-04-12 12:33:27 GMT

                                    

Comments
EVALUATION

Currently there are 19 classes defining oldSerialVersionUID and newSerialVersionUID, and setting in a static initialization block their actual serialVersionUID to either one of these values depending on the system property jmx.serial.form.

Ideally we would like this information to appear in the Serialized Form javadoc page, as the first information for each class. I did not manage to achieve that so far because the @serial tag must document default serializable fields (so in particular non static) and is ignored in other cases. It is also ignored if used in the main description of the class to add a comment for the Serialized Form page.

Unless I am missing something, possible options I see are:

* either add this  serialVersionUID information to the the main javadoc description of the class (but it will not appear in the Serialized Form page)

* or add it to the writeObject and readObject methods javadoc information for the 2 classes that extend the default mechanism, and to the @serial information of an already existing field for the 17 others (a bit ugly though).

For information, the impacted classes are:
javax/management/ClassAttributeValueExp.java
javax/management/modelmbean/DescriptorSupport.java
javax/management/modelmbean/InvalidTargetObjectTypeException.java
javax/management/modelmbean/ModelMBeanAttributeInfo.java
javax/management/modelmbean/ModelMBeanConstructorInfo.java
javax/management/modelmbean/ModelMBeanInfoSupport.java
javax/management/modelmbean/ModelMBeanNotificationInfo.java
javax/management/modelmbean/ModelMBeanOperationInfo.java
javax/management/modelmbean/XMLParseException.java
javax/management/Notification.java
javax/management/NumericValueExp.java
javax/management/ObjectName.java
javax/management/relation/MBeanServerNotificationFilter.java
javax/management/relation/RelationNotification.java
javax/management/relation/RelationTypeSupport.java
javax/management/relation/RoleInfo.java
javax/management/relation/Role.java
javax/management/relation/RoleResult.java
javax/management/relation/RoleUnresolved.java
                                     
2005-09-22
EVALUATION

Should be sufficient to visit all classes that define a field called oldSerialVersionUID and add the appropriate tag to them.  The Javadoc output for these classes will look different from that of classes that have a plain constant serialVersionUID, but that is all right.
###@###.### 2005-04-12 12:33:28 GMT
                                     
2005-04-12



Hardware and Software, Engineered to Work Together