jmx-dev RFR: JDK-8275244: Suppress warnings on non-serializable array component types in jdk.management

Joe Darcy darcy at openjdk.java.net
Wed Oct 13 20:07:14 UTC 2021


After a refinement to the checks under development in #5709, the new checks examine array types of serial fields and warn if the underlying component type is not serializable. Per the JLS, all array types are serializable, but if the base component is not serializable, the serialization process can throw an exception.

>From "Java Object Serialization Specification: 2 - Object Output Classes":

"If the object is an array, writeObject is called recursively to write the ObjectStreamClass of the array. The handle for the array is assigned. It is followed by the length of the array. Each element of the array is then written to the stream, after which writeObject returns."

The jdk.management module has an instance of this coding pattern that need suppression to compile successfully under the future warning.

-------------

Commit messages:
 - JDK-8275244: Suppress warnings on non-serializable array component types in jdk.management

Changes: https://git.openjdk.java.net/jdk/pull/5934/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5934&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8275244
  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5934.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5934/head:pull/5934

PR: https://git.openjdk.java.net/jdk/pull/5934


More information about the jmx-dev mailing list