more specific inference: do not compare functional types if both methods were generic

This commit is contained in:
Anna Kozlova
2014-02-20 22:40:17 +01:00
parent e42ff74cc5
commit d2c3b4baef
3 changed files with 30 additions and 1 deletions
@@ -540,7 +540,8 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
return Specifics.FIRST;
}
}
if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8) && myArgumentsList instanceof PsiExpressionList) {
if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8) && myArgumentsList instanceof PsiExpressionList && (typeParameters1.length == 0 || typeParameters2.length == 0)) {
boolean toCompareFunctional = false;
for (int i = 0; i < myActualParameterTypes.length; i++) {
if (types1.length > 0 && LambdaUtil.isFunctionalType(types1[Math.min(i, types1.length - 1)]) &&
@@ -0,0 +1,24 @@
import java.util.Collection;
import java.util.HashSet;
class A {
Collection<String> thrownInTryStatement = null;
final Collection<String> thrownTypes = ContainerUtil.newHashSet( thrownInTryStatement);
}
class ContainerUtil extends ContainerUtilRt{
public static <T> HashSet<T> newHashSet(Iterable<? extends T> iterable) {
return null;
}
}
class ContainerUtilRt {
public static <T> HashSet<T> newHashSet(Iterable<? extends T> iterable) {
return null;
}
}
@@ -148,6 +148,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
doTest();
}
public void testStaticInheritorsAmbiguity() throws Exception {
doTest();
}
private void doTest() throws Exception {
doTest(false);
}