On Mon, 2 Mar 2026 21:50:28 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 5132:
>
>> 5130: if (serialMethodNames.contains(name)) {
>> 5131: switch (name) {
>> 5132: case "writeObject" ->
>> isSerialMethodCorrect[0] = hasAppropriateWriteObject(tree, e, method);
>
> some changes in this method and in the methods invoked here were not strictly
> necessary but were done for the sake of uniformity
Can we convert this to a switch expression, like:
isSerialMethodCorrect[0] = switch (name) {
case "writeObject" -> hasAppropriateWriteObject(tree, e, method);
and so on.
-------------
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2187#discussion_r2881654636