mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
reject 1.7 varargs hack as 1.8 reject the code again even with target 1.7
This commit is contained in:
+2
-13
@@ -367,7 +367,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
boolean toFilter = false;
|
||||
for (CandidateInfo conflict : conflicts) {
|
||||
ProgressManager.checkCanceled();
|
||||
@MethodCandidateInfo.ApplicabilityLevelConstant final int level = preferVarargs((MethodCandidateInfo)conflict);
|
||||
@MethodCandidateInfo.ApplicabilityLevelConstant final int level = ((MethodCandidateInfo)conflict).getPertinentApplicabilityLevel();
|
||||
if (maxApplicabilityLevel > 0 && maxApplicabilityLevel != level) {
|
||||
toFilter = true;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
for (Iterator<CandidateInfo> iterator = conflicts.iterator(); iterator.hasNext();) {
|
||||
ProgressManager.checkCanceled();
|
||||
CandidateInfo info = iterator.next();
|
||||
final int level = preferVarargs((MethodCandidateInfo)info);
|
||||
final int level = ((MethodCandidateInfo)info).getPertinentApplicabilityLevel();
|
||||
if (level < maxApplicabilityLevel) {
|
||||
iterator.remove();
|
||||
}
|
||||
@@ -390,17 +390,6 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
return maxApplicabilityLevel;
|
||||
}
|
||||
|
||||
private static int preferVarargs(MethodCandidateInfo info) {
|
||||
final int level = info.getPertinentApplicabilityLevel();
|
||||
if (level == MethodCandidateInfo.ApplicabilityLevel.FIXED_ARITY) {
|
||||
final PsiMethod psiMethod = info.getElement();
|
||||
if (psiMethod != null && psiMethod.isVarArgs() && JavaVersionService.getInstance().isAtLeast(psiMethod, JavaSdkVersion.JDK_1_7)) {
|
||||
return level + 1;
|
||||
}
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
||||
private static int getCheckAccessLevel(MethodCandidateInfo method){
|
||||
boolean visible = method.isAccessible();
|
||||
return visible ? 1 : 0;
|
||||
|
||||
+1
-1
@@ -12,6 +12,6 @@ class C<T extends A & B>
|
||||
{
|
||||
void bar(T x)
|
||||
{
|
||||
x.foo(null);
|
||||
x.foo<error descr="Ambiguous method call: both 'A.foo(String[]...)' and 'B.foo(String[])' match">(null)</error>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user