<Sound Dev> RFR: 8259522: Apply java.io.Serial annotations in java.desktop

Alexey Ivanov aivanov at openjdk.java.net
Tue Jan 12 20:25:56 UTC 2021


On Mon, 11 Jan 2021 06:21:52 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

> 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
> 
> Notes:
>   - 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:
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2019-August/062046.html

Marked as reviewed by aivanov (Reviewer).

src/java.desktop/share/classes/com/sun/media/sound/InvalidDataException.java line 42:

> 40:      */
> 41:     @Serial
> 42:     private static final long serialVersionUID = 1L;

This is the standard wording, yet should it mention the serialization is between the same versions only because the value of serialVersionUID is not unique?

src/java.desktop/share/classes/java/awt/image/RasterFormatException.java line 28:

> 26: package java.awt.image;
> 27: 
> 28: 

Suggestion:


In the majority of classes, there's only one empty line between package declaration and the first import statement.

src/java.desktop/share/classes/java/awt/image/ImagingOpException.java line 28:

> 26: package java.awt.image;
> 27: 
> 28: 

Suggestion:

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

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


More information about the sound-dev mailing list