mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
method ambiguity: compare ellipsis assignability with Object... only
This commit is contained in:
+3
-2
@@ -128,7 +128,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
}
|
||||
}
|
||||
|
||||
private void checkSpecifics(List<CandidateInfo> conflicts, @MethodCandidateInfo.ApplicabilityLevelConstant int applicabilityLevel) {
|
||||
public void checkSpecifics(List<CandidateInfo> conflicts, @MethodCandidateInfo.ApplicabilityLevelConstant int applicabilityLevel) {
|
||||
final boolean applicable = applicabilityLevel > MethodCandidateInfo.ApplicabilityLevel.NOT_APPLICABLE;
|
||||
|
||||
int conflictsCount = conflicts.size();
|
||||
@@ -450,7 +450,8 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
PsiType type1 = params1[Math.min(i, params1.length - 1)].getType();
|
||||
PsiType type2 = params2[Math.min(i, params2.length - 1)].getType();
|
||||
if (applicabilityLevel == MethodCandidateInfo.ApplicabilityLevel.VARARGS) {
|
||||
if (type1 instanceof PsiEllipsisType && type2 instanceof PsiEllipsisType) {
|
||||
if (type1 instanceof PsiEllipsisType && type2 instanceof PsiEllipsisType &&
|
||||
(((PsiArrayType)type1).getComponentType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT) || ((PsiArrayType)type2).getComponentType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT))) {
|
||||
type1 = ((PsiEllipsisType)type1).toArrayType();
|
||||
type2 = ((PsiEllipsisType)type2).toArrayType();
|
||||
}
|
||||
|
||||
+9
-1
@@ -21,4 +21,12 @@ abstract class A {
|
||||
{
|
||||
foo<error descr="Ambiguous method call: both 'A.foo(Object...)' and 'A.foo(int...)' match">(1)</error>;
|
||||
}
|
||||
}
|
||||
}
|
||||
abstract class A1 {
|
||||
abstract void foo(double ... x);
|
||||
abstract void foo(int... x);
|
||||
|
||||
{
|
||||
foo(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user