find class or interface to search the method: stop when accessible method is found even with static problem (IDEA-169504)

This commit is contained in:
Anna.Kozlova
2017-03-15 10:38:09 +01:00
parent c300df94b5
commit 9dfdd49e17
3 changed files with 13 additions and 1 deletions

View File

@@ -69,7 +69,7 @@ public class MethodCandidatesProcessor extends MethodsProcessor{
if (acceptVarargs() && method.isVarArgs() && PsiUtil.isLanguageLevel8OrHigher(myPlace)) {
add(createCandidateInfo(method, substitutor, staticProblem, isAccessible, true));
}
myHasAccessibleStaticCorrectCandidate |= isAccessible && !staticProblem;
myHasAccessibleStaticCorrectCandidate |= isAccessible;// && !staticProblem;
}
}

View File

@@ -0,0 +1,8 @@
class Foo {
static class Bar {
static final String s = <error descr="Non-static method 'toString()' cannot be referenced from a static context">toString</error>(1);
}
static String toString(int x) {
return x + "";
}
}

View File

@@ -244,6 +244,10 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testStaticMethodInOuterClassConflictWithToString() throws Exception {
doTest();
}
private void doTest() {
doTest(true);
}