JDK-8339559 : Remove serialVersionUID compatibility logic from JMX
  • Type: CSR
  • Component: core-svc
  • Sub-Component: javax.management
  • Priority: P4
  • Status: Draft
  • Resolution: Unresolved
  • Fix Versions: 24
  • Submitted: 2024-09-04
  • Updated: 2024-09-09
Related Reports
CSR :  
Description
Summary
-------

Remove JMX Serialization compatibility with very old JMX releases (1.0, 1.1, 1.2), which are from before JMX was an integrated part of the JDK.

Problem
-------

Various JMX classes are serializable, but unlike most serializable classes, they compute a `serialVersionUID` value instead of defining that value as a constant. The reason for this is for serialization compatibility with JMX 1.0. These classes used certain SVUID values in 1.0 and different values in 1.1 and later; thus, by default, 1.0 was serialization incompatible with 1.1 and later.

There is a switch to change the behavior. If the `jmx.serial.form` system property is set to "1.0" these classes will use the "old" SVUID values corresponding to those used in 1.0; otherwise they will use the "new" SVUID values for 1.1 and later. This enables the JMX running in a given JVM to be compatible with 1.0 or with 1.1-and-later, but not both.

Additionally, in JMX 1.2, field names are forced to lower-case before being written, contradicting the specification, and the `jmx.serial.form` property enabled bug-compatibility with that (see src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java).

This compatibility logic adds unnecessary complexity to many classes and their serialization operations.


Solution
-------

Simply remove the feature.  It is reasonable to remove this compatibility courtesy given that it is around 20 years old.  There is no reason for a JMX application running JDK 24 to be compatible with JMX distributions from before JMX was integrated into JDK 5 (released in September 2004).


Specification
-------

The System property `jmx.serial.form` will be ignored.

Github PR: https://github.com/openjdk/jdk/pull/20856

Comments
Attached two screen grabs of serialized-form.html, before and after, showing the old version with jmx.serial.form mentioned, and the new version without. specdiff does not appear to diff this file as far as I can tell, or does not see the change, and the private methods affected are not in the general public api docs. But the change is happening in serialized-form.html. Only ObjectName is affected here. Other methods must have been cleaned up previously, or never had this information, as even in jdk8 only ObjectName has this information in serialized-form.html.
09-09-2024

[~dfuchs], yes a diff of the serial form information should be included in the CSR; thanks for asking.
06-09-2024

The property appears in the serial form of some JMX classes in the public API doc - for instance, search for "jmx.serial.form" here: https://docs.oracle.com/en/java/javase/22/docs/api/serialized-form.html The PR has updated the readObject API of these classes to only document the "new" serial form. [~darcy] Should the diff in the public serial form text be pasted here? Note that although the property settings affected a lot more classes than ObjectName, its effect was only documented for ObjectName (which is arguably the most prominent serializable class in theh API)
06-09-2024