On Wed, 4 Mar 2026 11:55:53 GMT, Vicente Romero <[email protected]> wrote:

>> This PR is adding a new serialization warning for the case when a value 
>> class declares one of the following serialization related methods:
>> 
>> - readObject
>> - writeObject
>> - readObjectNoData
>> 
>> They have no effect if declared in value classes, fact that should be 
>> notified to the user,
>> 
>> TIA
>
> Vicente Romero has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - Update src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
>    
>    Co-authored-by: Chen Liang <[email protected]>
>  - Update src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
>    
>    Co-authored-by: Chen Liang <[email protected]>

src/java.base/share/classes/java/time/chrono/HijrahDate.java line 667:

> 665:      */
> 666:     @java.io.Serial
> 667:     @SuppressWarnings("serial")

The other uses of `@SuppressSerial` in the JDK tend to have a comment 
explaining why the warning is being suppressed.

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java line 5035:

> 5033:             // Check for missing serialVersionUID; check *not* done
> 5034:             // for enums or records.
> 5035:             VarSymbol svuidSym = null;

Do value classes need any distinct serialVersionUID handling?

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java line 5058:

> 5056:             // fields
> 5057:             final Map<String, Symbol> declaredSerialMethodNames = new 
> HashMap<>();
> 5058:             final boolean[] isSerialMethodCorrect = new boolean[] { 
> false };

Why is a one-element boolean array being used as opposed to a (non-final) 
boolean?

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java line 5167:

> 5165:                 }
> 5166:             }
> 5167:             if (c.isValueClass()) {

I think a short comment here explaining the rules for serializable value 
classes would be helpful.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2187#discussion_r2884952927
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2187#discussion_r2884969394
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2187#discussion_r2884960571
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2187#discussion_r2884964491

Reply via email to