mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
overload conflicts: assume that subsignature conflicts are already resolved when most specific are checked (IDEA-168894)
This commit is contained in:
@@ -20,7 +20,6 @@ import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.JavaVersionService;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiSuperMethodImplUtil;
|
||||
@@ -679,12 +678,12 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
}
|
||||
|
||||
if (class1 != class2) {
|
||||
if (class2.isInheritor(class1, true) || class1.isInterface() && !class2.isInterface()) {
|
||||
if (class2.isInheritor(class1, true)) {
|
||||
if (isSubSignature(method1, method2, classSubstitutor1, classSubstitutor2, boxingHappened)) {
|
||||
return Specifics.SECOND;
|
||||
}
|
||||
}
|
||||
else if (class1.isInheritor(class2, true) || class2.isInterface()) {
|
||||
else if (class1.isInheritor(class2, true)) {
|
||||
if (isSubSignature(method2, method1, classSubstitutor2, classSubstitutor1, boxingHappened)) {
|
||||
return Specifics.FIRST;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package p;
|
||||
|
||||
import static p.A.of;
|
||||
import static p.B.of;
|
||||
|
||||
class Test {
|
||||
{
|
||||
of(1, 2, 3);
|
||||
of<error descr="Ambiguous method call: both 'A.of(Integer)' and 'B.of(Integer)' match">(4)</error>;
|
||||
}
|
||||
}
|
||||
@@ -112,6 +112,25 @@ public class LightAdvHighlightingFixtureTest extends LightCodeInsightFixtureTest
|
||||
myFixture.checkHighlighting();
|
||||
}
|
||||
|
||||
public void testAmbiguousMethodCallWhenStaticImported() throws Exception {
|
||||
myFixture.addClass("package p;" +
|
||||
"class A<K> {\n" +
|
||||
" static <T> A<T> of(T t) {\n" +
|
||||
" return null;\n" +
|
||||
" }\n" +
|
||||
"}\n" +
|
||||
"class B<K> {\n" +
|
||||
" static <T> B<T> of(T t) {\n" +
|
||||
" return null;\n" +
|
||||
" }\n" +
|
||||
" static <T> B<T> of(T... t) {\n" +
|
||||
" return null;\n" +
|
||||
" }\n" +
|
||||
"}\n");
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/advFixture";
|
||||
|
||||
Reference in New Issue
Block a user