RFR: JDK-8312415: Expand -Xlint:serial checks to enum constants with specialized class bodies

Jonathan Gibbons jjg at openjdk.org
Mon Jul 24 19:56:45 UTC 2023


On Mon, 24 Jul 2023 19:15:11 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> Thanks to @lahodaj for providing the code to bridge into the class used for a enum constant with a specialized body.
> 
> This changes expands serialization warnings to the contents of any such class bodies.

Approved, but see question for Check.java

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

> 5217:                     case ENUM_CONSTANT -> {
> 5218:                         var field = (VarSymbol)enclosed;
> 5219:                         if (field.isEnum()) {

It's not wrong, but is this check redundant?  When can an `ENUM_CONSTANT` not be `isEnum()` ?

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

Marked as reviewed by jjg (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15004#pullrequestreview-1544158757
PR Review Comment: https://git.openjdk.org/jdk/pull/15004#discussion_r1272687421


More information about the compiler-dev mailing list