JDK-4147326 : Doclet API: Need serialVersionUID to be included in Serialized Form page
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 1.2.0
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5
  • CPU: generic
  • Submitted: 1998-06-10
  • Updated: 2002-06-27
  • Resolved: 2001-03-30
Related Reports
Duplicate :  
Relates :  
Description
The serialVersionUID should be in the Serialized Form generated by 
javadoc standard doclet.

The following method is missing from javadoc.ClassDoc.

  /** 
   * Returns the serialVersionUID for the class represented by ClassDoc.
   * The serialVersionUID is 0L if the class is not Serializable.
   */
  long serialVersionUID();

This capability was not originally implemented due to the complexity involved
in computing the serialVersionUID.  The serialVersionUID is simply the
the special static final member serialVersionUID OR it is computed based on
a complex hash including the signatures of almost all the members of the
class. (Actual computation is in java.io.ObjectStreamClass.computeSerialVersionUID() and it is described
in the Object Serialization Specification.)

Initial attempts to access the static final member serialVersIonUID within
javadoc context were not successful in accessing the value of the static final member serialVersionUID. There exists a chance that the static final members
are not initialized yet in the stage of compilation that javadoc has completed.

This bug report is a record that this feature was not implemented originally.

Comments
PUBLIC COMMENTS .
10-06-2004

EVALUATION Robert Field writes: > > Joe, > > Is this something that must be fixed for 1.2? Robert, I am not sure how critical it is or not. My customer for this is QA. They are just starting to write the serialization tests based on the generated serialized forms, they might become more insistent that this be investigated further to see if it really is not doable with undo performance impact.. I recorded the bug to document this missing feature and do not have a feel yet on whether it must be fixed or not. I have a lot of documentation changes, in serialization javadoc and in the serialization specification, before considering whether there is a fix for this. Do you think it is possible to get the value of the special serialization member, serialVersionUID, a private static final member within javadoc? It might be good enough if we could implement this part of serialVersionUID computation for now. I tried once to get the value using sun.tools.java.MemberDefinition.getValue() and I was not able to get the value when the class defined a serialVersionUID member. I assumed that there was a good chance that not enough of the compilation has taken place to be retrieving constant values within javadoc, I wanted to confirm this suspicion with you. I never attempted to research it on my own. -Joe Only the first passes of compilation are done to extract the information supplied to the javadoc API. I do not believe that compilation has progressed far enough to be able to compute this information. robert.field@Eng 1998-06-16 Its not clear that this will be any different in the new compiler. neal.gafter@Eng 2000-12-13
16-06-1998