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

Add tests for accidental changes to the serialized form of a class

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • None
    • None
    • core-libs
    • None

    Description

      JDK-8266571 inadvertently added a field to the serialized form of LinkedHashMap; the issue was corrected by JDK-8309882.

      This seems like something that could be detected by testing. It would be good to create tests for detecting accidental changes to serializable fields. This would include additions, removals, and changes to names or types of fields, and possibly other changes.

      Some of these changes are compatible according to JOSS Chapter 5. The main focus here is to detect accidental changes, even if those changes are compatible.

      An issue to be decided is, which classes' serialized forms need to be checked in this way. It could be all serializable classes in the JDK, or only those in java.base, or including or excluding selected modules. For example, many Swing classes are serializable, but release-to-release compatibility isn't guaranteed. It therefore might not be worth including such classes in the test. See the warning at the bottom of the class specification of JComponent:

      https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/JComponent.html

      Attachments

        Issue Links

          Activity

            People

              rgiulietti Raffaello Giulietti
              bchristi Brent Christian
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: