jmx-dev RFR: 8374838: Apply java.io.Serial annotations in java.management.*
Sergey Bylokhov
serb at openjdk.org
Wed Feb 18 07:47:11 UTC 2026
On Fri, 9 Jan 2026 19:45:27 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
> 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 =`
It seems it would be better to split this large patch into smaller parts. I’ll do that.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29145#issuecomment-3919223591
More information about the jmx-dev
mailing list