<i18n dev> RFR: 8259522: Apply java.io.Serial annotations in java.desktop

Sergey Bylokhov serb at openjdk.java.net
Mon Jan 11 08:19:19 UTC 2021

Please review the application of @java.io.Serial annotation (JDK-8202385) to types in the desktop module to enable stricter compile-time checking of serialization-related declarations.

This annotation can be applied to these methods in the module:

    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

  - I have tried to update the comments for serialVersionUID as accurately as possible, but mostly based on the source code history and bugs in JBS where that field was added
  - Some of the readObject/writeObject methods in the javax.swing package does not have a spec, because this package and some others are excluded from the serialization specification.

A similar fix was implemented for java.base module as well:


Commit messages:
 - Update TextAttribute.java
 - Update readResolve
 - Update writeReplace
 - Update readObject
 - Update writeObject
 - Update serialPersistentFields
 - Update serialVersionUID

Changes: https://git.openjdk.java.net/jdk/pull/2020/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2020&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8259522
  Stats: 3426 lines in 343 files changed: 2268 ins; 287 del; 871 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2020.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2020/head:pull/2020

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

More information about the i18n-dev mailing list