RFR: 8343306: javac is failing to determine if a class and a sealed interface are disjoint [v6]

Vicente Romero vromero at openjdk.org
Thu Nov 7 14:24:45 UTC 2024


On Thu, 7 Nov 2024 14:04:11 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   addressing review comments
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1697:
> 
>> 1695:                         } else if (csym.isSealed()) {
>> 1696:                             return areDisjoint(isym, csym.getPermittedSubclasses());
>> 1697:                         } else if (isym.isSealed()) {
> 
> where did the freely extensible check go? That part is in the spec, but there's no code for it?

Jan suggested in a previous comment that: `isClassFreelyExtensible == !csym.isSealed() && !csym.isFinal()`, which I think is correct. At this point we have checked that the class is not final and not sealed so if the interface is sealed we do the check for disjoint-ness between the class and the interface's permitted subclasses

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21794#discussion_r1832765628


More information about the compiler-dev mailing list