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

JDK 7 Serializable Swing classes not compatible with JDK 6

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 21
    • client-libs
    • None
    • behavioral
    • minimal
    • Documenting long standing behaviour
    • Java API
    • SE

      Summary

      Make clear that no Swing classes guarantee a compatible serialized form across either releases or platforms.


      Problem

      The warning that serialized object of a Swing class may not be compatible with other Swing releases is not mentioned in all serializable Swing classes

      Solution

      The warning is added to the top-level java.swing package to encompass all serializable Swing classes. Also it is added in the specific classes cited in the bug report, as there is already ample precedent for that. Note: the API javadoc text says "will not" although there is no active mechanism to break compatibility these words make it more clear that it is the norm to be incompatible rather than an exception.

      Specification

      javax.swing.package-info.java

        *   href="https://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">
            * Concurrency in Swing</a>.
            *
          + * <h2><a id="serialization">Swing's Serialization policy</a></h2>
          + * <strong>Warning:</strong>
          + * Serialized objects of any Swing class will not be compatible with
          + * future Swing releases. The current serialization support is
          + * appropriate for short term storage or RMI between applications running
          + * the same version of Swing.  As of 1.4, support for long term storage
          + * of all JavaBeans
          + * has been added to the <code>java.beans</code> package.
          + *
            * <h2><a id="related">Related Documentation</a></h2>
          + *
            * For overviews, tutorials, examples, guides, and other documentation,
            * please see:

      javax.swing.LayoutComparator.java

      /**
        * Comparator which attempts to sort Components based on their size and
        * position. Code adapted from original javax.swing.DefaultFocusManager
        * implementation.
      + * <strong>Warning:</strong>
      + * Serialized objects of this class will not be compatible with
      + * future Swing releases. The current serialization support is
      + * appropriate for short term storage or RMI between applications running
      + * the same version of Swing.  As of 1.4, support for long term storage
      + * of all JavaBeans has been added to the <code>java.beans</code> package.

      * javax.swing.text.html.parser.ParserDelegator.java

       /**
        * Responsible for starting up a new DocumentParser
        * each time its parse method is invoked. Stores a
        * reference to the dtd.
      - *
      + * <strong>Warning:</strong>
      + *  Serialized objects of this class will not be compatible with
      + *  future Swing releases. The current serialization support is
      + *  appropriate for short term storage or RMI between applications running
      + *  the same version of Swing.  As of 1.4, support for long term storage
      + *  of all JavaBeans
      + *  has been added to the <code>java.beans</code> package

            psadhukhan Prasanta Sadhukhan
            dkorbel David Korbel (Inactive)
            Philip Race, Sergey Bylokhov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: