RFR: JDK-8312415: Expand -Xlint:serial checks to enum constants with specialized class bodies
Jonathan Gibbons
jjg at openjdk.org
Mon Jul 24 20:03:44 UTC 2023
On Mon, 24 Jul 2023 19:53:02 GMT, Jonathan Gibbons <jjg 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.
>
> 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()` ?
See these lines in `Symbol.java` `public ElementKind getKind()` line 1725:
} else if ((flags & ENUM) != 0) {
return ElementKind.ENUM_CONSTANT;
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15004#discussion_r1272694387
More information about the compiler-dev
mailing list