[jdk16] RFR: 8258972: unexpected compilation error with generic sealed interface
Jan Lahoda
jlahoda at openjdk.java.net
Mon Jan 4 21:32:59 UTC 2021
On Tue, 29 Dec 2020 19:04:16 GMT, Vicente Romero <vromero at openjdk.org> wrote:
> Hi,
>
> Please review this fix to the implementation of section `5.1.6.1 Allowed Narrowing Reference Conversion` of the Sealed Classes spec [1](http://cr.openjdk.java.net/~gbierman/jep397/jep397-20201204/specs/sealed-classes-jls.html#jls-5.1.6.1). IMO the compiler was not implementing the spec to the letter in particular the inheritance relation between a sealed class and a subclass should be tested ignoring type arguments which is what this patch is doing. Comments?
>
> Thanks,
> Vicente
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1670:
> 1668: // where
> 1669: private boolean areDisjoint(ClassSymbol ts, ClassSymbol ss) {
> 1670: if (isSubtype(erasure(ts.type), erasure(ss.type))) {
There is another `isSubtype` below - could you please check if it needs the same erasure handling?
-------------
PR: https://git.openjdk.java.net/jdk16/pull/72
More information about the compiler-dev
mailing list