On Mon, 2 Mar 2026 20:50:19 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

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

> 5318: 
> 5319:             // private void writeObject(ObjectOutputStream stream) 
> throws IOException
> 5320:             return isPrivateNonStaticMethod(tree, method) &  // no 
> short-circuit we need to evaluate all

Suggestion:

            return isPrivateNonStaticMethod(tree, method) &  // no 
short-circuit we need to log warnings

Same for other comments

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

> 5679:         private boolean hasExpectedArg(JCClassDecl tree,
> 5680:                                     MethodSymbol method,
> 5681:                                     Type expectedType) {

Suggestion:

                                       MethodSymbol method,
                                       Type expectedType) {

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2187#discussion_r2881659800
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2187#discussion_r2881661357

Reply via email to