overload resolution: don't prefer generic to raw substitution (IDEA-149289)

This commit is contained in:
Anna Kozlova
2015-12-28 10:27:00 +01:00
parent aa70efc9a4
commit d9aeacbf48
3 changed files with 18 additions and 6 deletions
@@ -675,12 +675,6 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
}
}
final boolean raw1 = PsiUtil.isRawSubstitutor(method1, classSubstitutor1);
final boolean raw2 = PsiUtil.isRawSubstitutor(method2, classSubstitutor2);
if (raw1 ^ raw2) {
return raw1 ? Specifics.SECOND : Specifics.FIRST;
}
final boolean varargs1 = info1.isVarargs();
final boolean varargs2 = info2.isVarargs();
if (varargs1 ^ varargs2) {
@@ -0,0 +1,14 @@
import java.util.List;
import java.util.Set;
abstract class Test {
public void foo(List list) {
set<error descr="Ambiguous method call: both 'Test.set(Set<List>, List)' and 'Test.set(Set, List)' match">(get(), list)</error>;
}
abstract <Y> Set<Y> get();
abstract <Y, X extends Y> void set(Set<Y> set, X x);
abstract <Y> void set(Set<Y> set, List<? extends Y> l);
}
@@ -191,6 +191,10 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
doTest(false);
}
public void testNoNeedToPreferGenericToRawSubstitution() throws Exception {
doTest();
}
private void doTest() {
doTest(true);
}