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

Why is java.util.Observable class not serializable.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.1.5, 1.1.6
    • core-libs
    • x86
    • 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)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: