overload resolution: skip static correctness check during overload resolution (IDEA-154187)

This commit is contained in:
Anna.Kozlova
2016-04-06 12:51:57 +02:00
parent c35fa1891b
commit 1bc380f6fd
3 changed files with 20 additions and 3 deletions
@@ -134,9 +134,6 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
checkPrimitiveVarargs(conflicts, getActualParametersLength());
if (conflicts.size() == 1) return conflicts.get(0);
checkAccessStaticLevels(conflicts, false);
if (conflicts.size() == 1) return conflicts.get(0);
Set<CandidateInfo> uniques = new THashSet<CandidateInfo>(conflicts);
if (uniques.size() == 1) return uniques.iterator().next();
return null;
@@ -0,0 +1,16 @@
class A<T> {
public void testMethod(T... values) {}
public void testMethod1(T values) {}
}
class B extends A<Integer> {
public static void testMethod(String... values) {}
public static void testMethod1(String values) {}
}
class Test45 {
public static void main(String[] args) {
B.testMethod<error descr="Ambiguous method call: both 'B.testMethod(String...)' and 'A.testMethod(Integer...)' match">()</error>;
B.testMethod1<error descr="Ambiguous method call: both 'B.testMethod1(String)' and 'A.testMethod1(Integer)' match">(null)</error>;
}
}
@@ -225,6 +225,10 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testIgnoreStaticCorrectnessDuringOverloadResolution() throws Exception {
doTest(false);
}
private void doTest() {
doTest(true);
}