RFR: 8355004: Apply java.io.Serial annotations in java.compiler

Chen Liang liach at openjdk.org
Sat Apr 26 03:05:44 UTC 2025


On Fri, 25 Apr 2025 22:46:07 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

> Please review the application of `@Serial` annotation ([JDK-8202385](https://bugs.openjdk.org/browse/JDK-8202385)) to types in the compiler module to enable stricter compile-time checking of serialization-related declarations. Just a few classes are covered.
> 
> 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
> 
> Any feedback or suggestions are welcome!

Hmm, was there no compiler warning from the lack of serial annotations?

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

PR Comment: https://git.openjdk.org/jdk/pull/24891#issuecomment-2831784693


More information about the compiler-dev mailing list