mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
overload resolution: don't prefer generic to raw substitution (IDEA-149289)
This commit is contained in:
-6
@@ -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) {
|
||||
|
||||
+14
@@ -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);
|
||||
}
|
||||
+4
@@ -191,6 +191,10 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testNoNeedToPreferGenericToRawSubstitution() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user