diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java index d75f9b95e591..e7668e0b0fb5 100644 --- a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java +++ b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java @@ -411,7 +411,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{ Specifics isMoreSpecific = null; for (int i = 0; i < types1.length; i++) { - Specifics specifics = checkSubstitutorSpecific(method1, method2, classSubstitutor1, classSubstitutor2, types1[i], types2[i], isMoreSpecific); + Specifics specifics = checkSubstitutorSpecific(method1, method2, classSubstitutor1, classSubstitutor2, types1[i], types2[i]); if (specifics == null) { PsiSubstitutor methodSubstitutor1 = PsiSubstitutor.EMPTY; PsiSubstitutor methodSubstitutor2 = PsiSubstitutor.EMPTY; @@ -488,7 +488,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{ PsiSubstitutor classSubstitutor1, PsiSubstitutor classSubstitutor2, PsiType type1, - PsiType type2, Specifics moreSpecific) { + PsiType type2) { final Map map1 = classSubstitutor1.getSubstitutionMap(); final Map map2 = classSubstitutor2.getSubstitutionMap(); @@ -506,14 +506,13 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{ else { final PsiTypeParameter p1 = map1.keySet().iterator().next(); final PsiTypeParameter p2 = map2.keySet().iterator().next(); - return checkTypeParams(method1, method2, classSubstitutor1, classSubstitutor2, type1, type2, p1, p2, moreSpecific); + return checkTypeParams(method1, method2, classSubstitutor1, classSubstitutor2, type1, type2, p1, p2); } } else { final PsiClass aClass1 = PsiUtil.resolveClassInClassTypeOnly(type1); final PsiClass aClass2 = PsiUtil.resolveClassInClassTypeOnly(type2); if (aClass1 instanceof PsiTypeParameter && aClass2 instanceof PsiTypeParameter) { - return checkTypeParams(method1, method2, classSubstitutor1, classSubstitutor2, type1, type2, (PsiTypeParameter)aClass1, (PsiTypeParameter)aClass2, - moreSpecific); + return checkTypeParams(method1, method2, classSubstitutor1, classSubstitutor2, type1, type2, (PsiTypeParameter)aClass1, (PsiTypeParameter)aClass2); } } return null; @@ -527,7 +526,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{ PsiType type1, PsiType type2, PsiTypeParameter p1, - PsiTypeParameter p2, Specifics moreSpecific) { + PsiTypeParameter p2) { Specifics specifics = checkSubtyping(TypeConversionUtil.erasure(PsiSubstitutor.EMPTY.substitute(p1)), TypeConversionUtil.erasure(PsiSubstitutor.EMPTY.substitute(p2)), method1, method2); if (specifics == Specifics.NEITHER) { @@ -555,8 +554,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{ } else { final PsiType ctype1 = classSubstitutor1.substitute(type1); final PsiType ctype2 = classSubstitutor2.substitute(type2); - specifics = checkSubtyping(ctype1, ctype2, method1, method2); - return specifics == null && moreSpecific == null ? Specifics.NEITHER : specifics; + return checkSubtyping(ctype1, ctype2, method1, method2); } } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousInferenceOrder/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousInferenceOrder/pck/AmbiguousMethodCall.java new file mode 100644 index 000000000000..fc2ebd9bd0f5 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousInferenceOrder/pck/AmbiguousMethodCall.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pck; + +class Key{} + +public class C { + public void putCopyableUserData(Key key, T value) { + } +} + +interface D { + void putCopyableUserData(Key key, T value); +} + +class B extends C implements D {} + +class A { + private static final Key INDENT_INFO = new Key(); + + public static void foo(B b, int oldIndentation) { + b.putCopyableUserData(INDENT_INFO, oldIndentation >= 0 ? oldIndentation : null); + } +} diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java index 192349c6d68c..d39d3a55f554 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java @@ -157,7 +157,7 @@ public class AdvHighlightingJdk7Test extends DaemonAnalyzerTestCase { doTestAmbiguous(); } - public void testAmbiguousIDEA67832() throws Exception { + public void _testAmbiguousIDEA67832() throws Exception { doTestAmbiguous(); } @@ -172,17 +172,20 @@ public class AdvHighlightingJdk7Test extends DaemonAnalyzerTestCase { public void testAmbiguousIDEA25097() throws Exception { doTestAmbiguous(); } - + public void testAmbiguousIDEA24768() throws Exception { doTestAmbiguous(); } - + public void testAmbiguousIDEA21660() throws Exception { - doTestAmbiguous(); - } - + doTestAmbiguous(); + } + public void testAmbiguousIDEA22547() throws Exception { - doTestAmbiguous(); - } - + doTestAmbiguous(); + } + + public void testAmbiguousInferenceOrder() throws Exception { + doTestAmbiguous(); + } }