reject 1.7 varargs hack as 1.8 reject the code again even with target 1.7

This commit is contained in:
Anna Kozlova
2014-02-24 20:35:44 +01:00
parent 2df995fd74
commit 7a9bf2ac51
2 changed files with 3 additions and 14 deletions
@@ -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;
@@ -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>;
}
}