mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
resolve static method: IDEA-64926
This commit is contained in:
+5
-1
@@ -213,11 +213,15 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
if (returnType1 != null && returnType2 != null) {
|
||||
returnType1 = infoSubstitutor.substitute(returnType1);
|
||||
returnType2 = existing.getSubstitutor().substitute(returnType2);
|
||||
if (returnType1.isAssignableFrom(returnType2)) {
|
||||
if (!returnType1.equals(returnType2) && returnType1.isAssignableFrom(returnType2)) {
|
||||
conflicts.remove(i);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// prefer derived class
|
||||
signatures.put(signature, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package p;
|
||||
|
||||
import static p.ToImportX.fff;
|
||||
import static p.ToImportX2.fff;
|
||||
|
||||
//IDEA-64926
|
||||
public class AppTest {
|
||||
public static void main(String[] args) {
|
||||
<ref>fff();
|
||||
}
|
||||
}
|
||||
|
||||
class ToImportX {
|
||||
public static void fff() {
|
||||
System.out.println("ToImport");
|
||||
}
|
||||
}
|
||||
|
||||
class ToImportX2 extends ToImportX {
|
||||
public static void fff() {
|
||||
System.out.println("ToImport2");
|
||||
}
|
||||
}
|
||||
@@ -84,6 +84,11 @@ public class ResolveMethod15Test extends Resolve15TestCase {
|
||||
PsiMethod parentMethod = PsiTreeUtil.getParentOfType(ref.getElement(), PsiMethod.class);
|
||||
assertEquals(method, parentMethod);
|
||||
}
|
||||
public void testStaticImportConflict3() throws Exception {
|
||||
final PsiJavaCodeReferenceElement ref = (PsiJavaCodeReferenceElement)configureByFile();
|
||||
final JavaResolveResult result = ref.advancedResolve(false);
|
||||
assertResolvesToMethodInClass(result, "ToImportX2");
|
||||
}
|
||||
|
||||
public void testGenericsAndVarargsNoConflict() throws Exception {
|
||||
final PsiReference ref = configureByFile();
|
||||
@@ -343,7 +348,7 @@ public class ResolveMethod15Test extends Resolve15TestCase {
|
||||
assertThat(target, instanceOf(PsiMethod.class));
|
||||
assertThat(target.getParent(), instanceOf(PsiClass.class));
|
||||
final PsiParameter[] parameters = ((PsiMethod)target).getParameterList().getParameters();
|
||||
assertTrue(parameters.length == 1);
|
||||
assertEquals(1, parameters.length);
|
||||
assertTrue(parameters[0].getType() instanceof PsiArrayType);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user