Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5075463

(enum) Serialized Form javadoc for java.lang.Enum is misleading

XMLWordPrintable

    • b07
    • sparc
    • solaris_8
    • Not verified



      Name: ygR10224 Date: 07/19/2004



        Filed By : SPB JCK team
        JDK : java full version "1.5.0-beta3-b58"
        JCK : 1.5
        Platform[s] : Solaris
        switch/Mode :
        JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
        Failing Test [s] : None
            

        Specification excerpt:
        ======================
        
        --------- J2SE API spec v.1.5 ---------
        ...
        Class java.lang.Enum extends Object implements Serializable

        Serialized Fields
        name

        String name
        The name of this enum constant, as declared in the enum declaration.
        Most programmers should use the Enum.toString() method rather than
        accessing this field.

        ordinal

        int ordinal
        The ordinal of this enumeration constant (its position in the
        enum declaration, where the initial constant is assigned an ordinal of
        zero). Most programmers will have no use for this field. It is designed
        for use by sophisticated enum-based data structures, such as EnumSet and
        EnumMap.
        ---------- end-of-excerpt ---------------


        Problem description
        ===================
        Serialized Form documentation for class java.lang.Enum
        define two fields. But Java Object Serialization Specification
        (http://java.sun.com/j2se/1.5/pdf/serial-1.5.0.pdf)
        states (page 11, "1.12 Serialization of Enum Constants")
        the following about serialization of the enum-type constants:
        ---
        ...
        Enum constants are serialized differently than ordinary serializable or
        externalizable objects. The serialized form of an enum constant consists
        solely of its name; field values of the constant are not present in the
        form.
        ...
        ---

        So Serialized Form javadoc for java.lang.Enum is ambiguous and
        should be bring in correspondence with JOSS.


      ======================================================================

            darcy Joe Darcy
            gyisunw Gyi Gyi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: