From 7a9bf2ac519056cc0f2bd004218a5d79609c05c0 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Mon, 24 Feb 2014 20:33:39 +0100 Subject: [PATCH] reject 1.7 varargs hack as 1.8 reject the code again even with target 1.7 --- .../JavaMethodsConflictResolver.java | 15 ++------------- .../pck/AmbiguousMethodCall.java | 2 +- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java index aecf22009155..54e43a59c5ec 100644 --- a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java +++ b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java @@ -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 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; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67573/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67573/pck/AmbiguousMethodCall.java index b63b6aa93132..918518e705c9 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67573/pck/AmbiguousMethodCall.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67573/pck/AmbiguousMethodCall.java @@ -12,6 +12,6 @@ class C { void bar(T x) { - x.foo(null); + x.foo(null); } }