8258972: unexpected compilation error with generic sealed interface
Reviewed-by: jlahoda
This commit is contained in:
parent
c1fb521694
commit
acdd90b699
@ -1667,11 +1667,11 @@ public class Types {
|
||||
}
|
||||
// where
|
||||
private boolean areDisjoint(ClassSymbol ts, ClassSymbol ss) {
|
||||
if (isSubtype(ts.type, ss.type)) {
|
||||
if (isSubtype(erasure(ts.type), erasure(ss.type))) {
|
||||
return false;
|
||||
}
|
||||
// if both are classes or both are interfaces, shortcut
|
||||
if (ts.isInterface() == ss.isInterface() && isSubtype(ss.type, ts.type)) {
|
||||
if (ts.isInterface() == ss.isInterface() && isSubtype(erasure(ss.type), erasure(ts.type))) {
|
||||
return false;
|
||||
}
|
||||
if (ts.isInterface() && !ss.isInterface()) {
|
||||
|
@ -1247,6 +1247,17 @@ public class SealedCompilationTests extends CompilationTestCase {
|
||||
a = (A)c;
|
||||
}
|
||||
}
|
||||
""",
|
||||
"""
|
||||
sealed interface A<T> {
|
||||
final class B implements A<Object> { }
|
||||
}
|
||||
|
||||
class Test {
|
||||
void f(A.B a, A<Object> b) {
|
||||
a = (A.B)b;
|
||||
}
|
||||
}
|
||||
"""
|
||||
)) {
|
||||
assertOK(s);
|
||||
|
Loading…
Reference in New Issue
Block a user