RFR: 8343306: javac is failing to determine disjoint-ness between a class and a sealed interface [v3]
Vicente Romero
vromero at openjdk.org
Thu Oct 31 18:43:30 UTC 2024
On Thu, 31 Oct 2024 18:03:33 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
>>
>> implementation closer to the spec
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1719:
>
>> 1717:
>> 1718: private boolean isClassFreelyExtensible(ClassSymbol csym) {
>> 1719: boolean anySuperIsSealed = (csym.getSuperclass().tsym != null && csym.getSuperclass().tsym.isSealed()) || csym.getInterfaces().stream().anyMatch(i -> i.tsym.isSealed());
>
> I am not sure about these checks. Should it be simply `isClassFreelyExtensible == !csym.isSealed() && !csym.isFinal()`? Or is the a particular case this is solving.
>
> (Besides this code being more complex, I suspect "non-sealed" is not restored when reading from classfiles - is that correct? Will this code do something sensible when `csym` is read from a classfile, and has a sealed supertype?)
yes I think you are right, will do
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21794#discussion_r1825016102
More information about the compiler-dev
mailing list