mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
static interface method call: ignore static imports if call is qualified (IDEA-136077)
This commit is contained in:
@@ -65,7 +65,10 @@ public class MethodCandidatesProcessor extends MethodsProcessor{
|
||||
}
|
||||
|
||||
private boolean isInterfaceStaticMethodAccessibleThroughInheritance(PsiMethod method) {
|
||||
if (method.hasModifierProperty(PsiModifier.STATIC) && !(myCurrentFileContext instanceof PsiImportStaticStatement)) {
|
||||
if (method.hasModifierProperty(PsiModifier.STATIC) &&
|
||||
!(myCurrentFileContext instanceof PsiImportStaticStatement) &&
|
||||
myPlace instanceof PsiMethodCallExpression &&
|
||||
((PsiMethodCallExpression)myPlace).getMethodExpression().getQualifierExpression() == null) {
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
return containingClass != null && containingClass.isInterface();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import java.util.function.Function;
|
||||
import static java.util.function.Function.identity;
|
||||
|
||||
class FunctionExample {
|
||||
public static void main(String [] args) throws Exception {
|
||||
Function f = Function.identity();
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,10 @@ public class Interface8MethodsHighlightingTest extends LightCodeInsightFixtureTe
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testStaticMethodAccessibleThroughStaticImportButExplicitlyQualified() throws Exception {
|
||||
doTest(true, false);
|
||||
}
|
||||
|
||||
public void testStaticMethodAccessibleBothThroughStaticImportAndInheritance() throws Exception {
|
||||
myFixture.addClass("package p; public interface Foo {" +
|
||||
" static void foo() {}" +
|
||||
|
||||
Reference in New Issue
Block a user