super expression rules should not apply to this expressions (IDEA-163303)

This commit is contained in:
Anna.Kozlova
2016-10-28 18:23:21 +02:00
parent f61f34b6dd
commit 80a5866b23
2 changed files with 17 additions and 1 deletions
@@ -1541,7 +1541,7 @@ public class HighlightUtil extends HighlightUtilBase {
}
}
if (qualifier != null && aClass.isInterface() && languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
if (qualifier != null && aClass.isInterface() && expr instanceof PsiSuperExpression && 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,
@@ -65,3 +65,19 @@ class Test {
}
}
class InsideThisRxpression {
interface Foo {
void fooMethod();
default Bar toBar() {
return new Bar() {
@Override
public void fooMethod() {
Foo.this.fooMethod();
}
};
}
}
public interface Bar extends Foo {}
}