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

doc error in java.io.Serializable (regarding accessible no-arg constructor)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.2.2
    • docs
    • beta2
    • generic
    • generic



      Name: rlT66838 Date: 09/02/99


      The API documentation for java.io.Serializable contains the
      following paragraph:

      "To allow subtypes of non-serializable classes to be serialized, the subtype may assume responsibility for saving and restoring the state of the supertype's
      public, protected, and (if accessible) package fields. The subtype may assume this responsibility only if the class it extends has an accessible no-arg
      constructor to initialize the class's state. It is an error to declare a class Serializable in this case. The error will be detected at runtime."

      The third sentence is incomprehensible and should probably read:
      "It is an error to declare a class Serializable <if this is not the> case".

      Alternatively, parts of the Object Serialization Specification could be copied:
      (http://www.javasoft.com/products/jdk/1.2/docs/guide/serialization/spec/serial-arch.doc10.html)
      "A Serializable class must do the following:

             . Implement the java.io.Serializable interface
             . Identify the fields that should be serializable
               (Use the serialPersistentFields member to explicitly declare them serializable or use the transient keyword to denote
               nonserializable fields.)

             . Have access to the no-arg constructor of its first nonserializable superclass"
      (Review ID: 94436)
      ======================================================================

            jhosunw Jamie Ho (Inactive)
            rlewis Roger Lewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: