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

Why is java.util.Observable class not serializable.


    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.1.5, 1.1.6
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
    • OS:
      windows_95, windows_nt


      Name: tb29552 Date: 10/10/98

      The following paragraph is a taken from JDK1.1.6
      class API specification for tha class java.io.ObjectOutputStream.

      "Serialization does not write out the fields of any object that does not
      implement the java.io.Serializable interface. Subclasses of Objects that are
      not serializable can be serializable. In this case the non-serializable class
      must have a no-arg constructor to allow its fields to be initialized. In this
      case it is the responsibility of the subclass to save and restore the state of
      the non-serializable class. It is frequently the case that the fields of that
      class are accessible (public, package, or protected) or that there are get and
      set methods that can be used to restore the state. "

      I want to create a class which extends from java.util.Observable and
      implements java.io.Serializable interface. From the above specification
      I cannot serialize the Observable class because:

      1.It does not implement Serializable interface.

      2.All it's members (obs Vector) are private so I cannot access
      them to write to the stream myself.
      (Review ID: 34853)

        Issue Links


          tbell Tim Bell created issue -
          smarks Stuart Marks made changes -
          Field Original Value New Value
          Link This issue relates to JDK-8154801 [ JDK-8154801 ]


            • Assignee:
              jjb Josh Bloch
              tbell Tim Bell
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: