8058244: missing error in qualified default super call
authorvromero
Tue, 14 Jun 2016 12:46:35 -0700
changeset 39092 399acd370763
parent 39091 40820960fdb9
child 39093 e4c63a49dbaf
child 39097 11d3d7e16f0e
8058244: missing error in qualified default super call Reviewed-by: mcimadamore
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
langtools/test/tools/javac/T8058244/MissingErrorInDefaultSuperCallTest.java
langtools/test/tools/javac/T8058244/MissingErrorInDefaultSuperCallTest.out
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue Jun 14 11:13:14 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue Jun 14 12:46:35 2016 -0700
@@ -3404,8 +3404,8 @@
                             types.asSuper(env.enclClass.type, c), env.enclClass.sym);
                 }
             }
-            //find a direct superinterface that is a subtype of 'c'
-            for (Type i : types.interfaces(env.enclClass.type)) {
+            //find a direct super type that is a subtype of 'c'
+            for (Type i : types.directSupertypes(env.enclClass.type)) {
                 if (i.tsym.isSubClass(c, types) && i.tsym != c) {
                     log.error(pos, "illegal.default.super.call", c,
                             diags.fragment("redundant.supertype", c, i));
@@ -3422,7 +3422,7 @@
         ListBuffer<Type> result = new ListBuffer<>();
         for (Type t1 : types.interfaces(t)) {
             boolean shouldAdd = true;
-            for (Type t2 : types.interfaces(t)) {
+            for (Type t2 : types.directSupertypes(t)) {
                 if (t1 != t2 && types.isSubtypeNoCapture(t2, t1)) {
                     shouldAdd = false;
                 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8058244/MissingErrorInDefaultSuperCallTest.java	Tue Jun 14 12:46:35 2016 -0700
@@ -0,0 +1,23 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8058244
+ * @summary missing error in qualified default super call
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ * @compile/fail/ref=MissingErrorInDefaultSuperCallTest.out -XDrawDiagnostics MissingErrorInDefaultSuperCallTest.java
+ */
+
+public class MissingErrorInDefaultSuperCallTest {
+    interface I {
+        default int f(){return 0;}
+    }
+
+    class J implements I {}
+
+    class T extends J implements I {
+        public int f() {
+            return I.super.f();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8058244/MissingErrorInDefaultSuperCallTest.out	Tue Jun 14 12:46:35 2016 -0700
@@ -0,0 +1,2 @@
+MissingErrorInDefaultSuperCallTest.java:20:21: compiler.err.illegal.default.super.call: MissingErrorInDefaultSuperCallTest.I, (compiler.misc.redundant.supertype: MissingErrorInDefaultSuperCallTest.I, MissingErrorInDefaultSuperCallTest.J)
+1 error