8259235: javac crashes while attributing super method invocation

Reviewed-by: vromero
This commit is contained in:
Jan Lahoda 2021-03-03 12:38:26 +00:00
parent bf90e8574d
commit 6d3c858cbb
3 changed files with 18 additions and 1 deletions

View file

@ -3782,7 +3782,7 @@ public class Resolve {
for (Type t1 : types.interfaces(t)) { for (Type t1 : types.interfaces(t)) {
boolean shouldAdd = true; boolean shouldAdd = true;
for (Type t2 : types.directSupertypes(t)) { for (Type t2 : types.directSupertypes(t)) {
if (t1 != t2 && types.isSubtypeNoCapture(t2, t1)) { if (t1 != t2 && !t2.hasTag(ERROR) && types.isSubtypeNoCapture(t2, t1)) {
shouldAdd = false; shouldAdd = false;
} }
} }

View file

@ -0,0 +1,15 @@
/**
* @test /nodynamiccopyright/
* @bug 8259235
* @summary Invocation of a method from a superinterface in a class that has an erroneous supertype
* should not crash javac.
* @compile/fail/ref=SuperMethodCallBroken.out -XDdev -XDrawDiagnostics SuperMethodCallBroken.java
*/
public abstract class SuperMethodCallBroken extends Undef implements I, java.util.List<String> {
public void test() {
I.super.test();
}
}
interface I {
public default void test() {}
}

View file

@ -0,0 +1,2 @@
SuperMethodCallBroken.java:8:53: compiler.err.cant.resolve: kindname.class, Undef, ,
1 error