RFR: 8347530: Improve error message with invalid permits clauses [v2]

Jan Lahoda jlahoda at openjdk.org
Fri May 16 12:45:52 UTC 2025


On Fri, 16 May 2025 12:42:35 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>> Currently we report one kind of error message (`subclass {0} must extend sealed class`) when there is a compile-type error in cases like the following:
>> 
>> 
>> sealed class C0 permits S0 {}
>> class S0 {}  
>> 
>> 
>> This PR proposes to improve error reporting since there are other kinds of declarations that can also participate in sealed hierarchies like records, enums and interfaces.
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address review

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 5474:

> 5472:                                                         .anyMatch(d -> d.tsym == c);
> 5473:                             if (!thisIsASuper) {
> 5474:                                 KindName subtypingLeftKind;

I wonder, would: `KindName.kindName(subType.tsym)` work?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25255#discussion_r2092971642


More information about the compiler-dev mailing list