mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ambiguous method calls: conflict resolver, tests (IDEA-78027)
This commit is contained in:
+2
-1
@@ -337,7 +337,8 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
boolean noBoxing = boxingHappening || type1 instanceof PsiPrimitiveType == type2 instanceof PsiPrimitiveType;
|
||||
final boolean allowUncheckedConversion =
|
||||
!method1.hasModifierProperty(PsiModifier.STATIC) && !method2.hasModifierProperty(PsiModifier.STATIC) ||
|
||||
method1.getContainingClass() == method2.getContainingClass();
|
||||
InheritanceUtil.isInheritorOrSelf(method1.getContainingClass(), method2.getContainingClass(), true) ||
|
||||
InheritanceUtil.isInheritorOrSelf( method2.getContainingClass(), method1.getContainingClass(),true);
|
||||
final boolean assignable2From1 = noBoxing && TypeConversionUtil.isAssignable(type2, type1, allowUncheckedConversion);
|
||||
final boolean assignable1From2 = noBoxing && TypeConversionUtil.isAssignable(type1, type2, allowUncheckedConversion);
|
||||
if (assignable1From2 || assignable2From1) {
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package pck;
|
||||
class Test {
|
||||
void test() {
|
||||
B.method(new ArgumentB());
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
static void method(ArgumentA a) { }
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
static void method(ArgumentB b) { }
|
||||
}
|
||||
|
||||
class ArgumentA<T> {}
|
||||
class ArgumentB extends ArgumentA<Object> {}
|
||||
@@ -164,4 +164,8 @@ public class AdvHighlightingJdk7Test extends DaemonAnalyzerTestCase {
|
||||
public void testAmbiguousIDEA67837() throws Exception {
|
||||
doTestAmbiguous();
|
||||
}
|
||||
|
||||
public void testAmbiguousIDEA78027() throws Exception {
|
||||
doTestAmbiguous();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user