varargs check can be applied for new java only (fix resolve tests)

This commit is contained in:
anna
2012-10-02 21:36:35 +02:00
parent a1bcdbf97b
commit 03693dcf99
2 changed files with 12 additions and 2 deletions
@@ -454,7 +454,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
PsiType type2 = params2[Math.min(i, params2.length - 1)].getType();
if (applicabilityLevel == MethodCandidateInfo.ApplicabilityLevel.VARARGS) {
if (type1 instanceof PsiEllipsisType && type2 instanceof PsiEllipsisType &&
(((PsiArrayType)type1).getComponentType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT) || ((PsiArrayType)type2).getComponentType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT))) {
(!JavaVersionService.getInstance().isAtLeast(class1, JavaSdkVersion.JDK_1_8) || ((PsiArrayType)type1).getComponentType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT) || ((PsiArrayType)type2).getComponentType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT))) {
type1 = ((PsiEllipsisType)type1).toArrayType();
type2 = ((PsiEllipsisType)type2).toArrayType();
}
@@ -18,6 +18,9 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.JavaVersionService;
import com.intellij.openapi.projectRoots.JavaVersionServiceImpl;
import org.jetbrains.annotations.NonNls;
public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
@@ -99,6 +102,13 @@ public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
}
private void doTest(final boolean warnings) throws Exception {
doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
final JavaVersionServiceImpl versionService = (JavaVersionServiceImpl)JavaVersionService.getInstance();
try {
versionService.setTestVersion(JavaSdkVersion.JDK_1_8);
doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
}
finally {
versionService.setTestVersion(null);
}
}
}