TypeName.super.foo() when TypeName denotes interface

This commit is contained in:
Anna Kozlova
2015-01-31 17:46:40 +03:00
parent 1dff071fc1
commit e315ef4b41
3 changed files with 17 additions and 2 deletions

View File

@@ -1448,8 +1448,8 @@ public class HighlightUtil extends HighlightUtilBase {
return HighlightClassUtil.reportIllegalEnclosingUsage(expr, null, aClass, expr);
}
if (qualifier != null && expr.getParent() instanceof PsiMethodReferenceExpression && aClass.isInterface()) {
//15.13
if (qualifier != null && aClass.isInterface() && languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
//15.12.1 for method invocation expressions; 15.13 for method references
//If TypeName denotes an interface, I, then let T be the type declaration immediately enclosing the method reference expression.
//It is a compile-time error if I is not a direct superinterface of T,
//or if there exists some other direct superclass or direct superinterface of T, J, such that J is a subtype of I.

View File

@@ -0,0 +1,11 @@
interface I {
default void m() {}
}
interface J extends I {}
class C implements I, J {
{
<error descr="Bad type qualifier in default super call: redundant interface I is extended by J">I</error>.super.m();
}
}

View File

@@ -788,6 +788,10 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
doTest(false);
}
public void testSuperInterfaceMethodCalledByMatterOfInterface() throws Exception {
doTest(false);
}
private void doTest() {
doTest(false);
}