RFR: 8374838: Apply java.io.Serial annotations in java.management.*
Sergey Bylokhov
serb at openjdk.org
Mon Jan 12 08:26:49 UTC 2026
Please review the application of the `@Serial` annotation ([JDK-8202385](https://bugs.openjdk.org/browse/JDK-8202385)) to types in the `java.management.*` modules. The goal is to enable stricter compile-time checking of serialization-related declarations.
The change is not small. I could split it, but I decided to do it as a single change since covering the module in one shot is easier than managing a bunch of separate PRs.
Example of a similar change https://github.com/openjdk/jdk/pull/24891.
Note: this annotation can be applied to these methods and fields:
* private void writeObject(java.io.ObjectOutputStream stream) throws IOException
* private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException
* private void readObjectNoData() throws ObjectStreamException
* ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException
* ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException
* private static final ObjectStreamField[] serialPersistentFields
* private static final long serialVersionUID
Additional changes:
- Copyright years were updated
- Imports were not touched much (no sorting or cleanup); the new import was added in a reasonable place
- In several places `static final long serialVersionUID =` was changed to
`private static final long serialVersionUID =`
-------------
Commit messages:
- 8374838: Apply java.io.Serial annotations in javax.management.*
Changes: https://git.openjdk.org/jdk/pull/29145/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29145&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8374838
Stats: 550 lines in 138 files changed: 382 ins; 0 del; 168 mod
Patch: https://git.openjdk.org/jdk/pull/29145.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29145/head:pull/29145
PR: https://git.openjdk.org/jdk/pull/29145
More information about the serviceability-dev
mailing list