Skip to content
Permalink
Browse files
8258972: unexpected compilation error with generic sealed interface
Reviewed-by: jlahoda
  • Loading branch information
Vicente Romero committed Jan 7, 2021
1 parent c1fb521 commit acdd90b699267db59967a21c4e75be033af0e5ce
Showing 2 changed files with 13 additions and 2 deletions.
@@ -1667,11 +1667,11 @@ public boolean isCastable(Type t, Type s, Warner warn) {
}
// 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 @@ void m(A a, C c) {
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);

0 comments on commit acdd90b

Please sign in to comment.