Skip to content

Commit 6d3c858

Browse files
committedMar 3, 2021
8259235: javac crashes while attributing super method invocation
Reviewed-by: vromero
1 parent bf90e85 commit 6d3c858

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed
 

‎src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3782,7 +3782,7 @@ private List<Type> pruneInterfaces(Type t) {
37823782
for (Type t1 : types.interfaces(t)) {
37833783
boolean shouldAdd = true;
37843784
for (Type t2 : types.directSupertypes(t)) {
3785-
if (t1 != t2 && types.isSubtypeNoCapture(t2, t1)) {
3785+
if (t1 != t2 && !t2.hasTag(ERROR) && types.isSubtypeNoCapture(t2, t1)) {
37863786
shouldAdd = false;
37873787
}
37883788
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @test /nodynamiccopyright/
3+
* @bug 8259235
4+
* @summary Invocation of a method from a superinterface in a class that has an erroneous supertype
5+
* should not crash javac.
6+
* @compile/fail/ref=SuperMethodCallBroken.out -XDdev -XDrawDiagnostics SuperMethodCallBroken.java
7+
*/
8+
public abstract class SuperMethodCallBroken extends Undef implements I, java.util.List<String> {
9+
public void test() {
10+
I.super.test();
11+
}
12+
}
13+
interface I {
14+
public default void test() {}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SuperMethodCallBroken.java:8:53: compiler.err.cant.resolve: kindname.class, Undef, ,
2+
1 error

0 commit comments

Comments
 (0)