mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
prefer generics to raw when more specific was not detected (IDEA-67576)
This commit is contained in:
+4
-6
@@ -502,12 +502,10 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
int level2 = getLevel(applicabilityLevel, languageLevel, method2, typeParameters2, types1, types2, resolveHelper);
|
||||
if (level1 > level2) return Specifics.SECOND;
|
||||
if (level2 > level1) return Specifics.FIRST;
|
||||
if (level1 == MethodCandidateInfo.ApplicabilityLevel.NOT_APPLICABLE) {
|
||||
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 raw1 = PsiUtil.isRawSubstitutor(method1, classSubstitutor1);
|
||||
final boolean raw2 = PsiUtil.isRawSubstitutor(method2, classSubstitutor2);
|
||||
if (raw1 ^ raw2) {
|
||||
return raw1 ? Specifics.SECOND : Specifics.FIRST;
|
||||
}
|
||||
}
|
||||
else if (applicabilityLevel == MethodCandidateInfo.ApplicabilityLevel.VARARGS) {
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package pck;
|
||||
|
||||
interface A<T>
|
||||
{
|
||||
<S> T foo();
|
||||
}
|
||||
|
||||
interface B
|
||||
{
|
||||
<S> Object foo();
|
||||
}
|
||||
|
||||
interface C extends A, B { }
|
||||
|
||||
class D
|
||||
{
|
||||
void bar(C x)
|
||||
{
|
||||
x.foo();
|
||||
}
|
||||
}
|
||||
@@ -207,6 +207,10 @@ public class AdvHighlightingJdk7Test extends DaemonAnalyzerTestCase {
|
||||
doTestAmbiguous();
|
||||
}
|
||||
|
||||
public void testAmbiguousIDEA67576() throws Exception {
|
||||
doTestAmbiguous();
|
||||
}
|
||||
|
||||
public void testAmbiguousMethodsFromSameClassAccess() throws Exception {
|
||||
doTestAmbiguous();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user