mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use mock jdk 8 by default in InspectionTestCase
This commit is contained in:
@@ -23,7 +23,6 @@ package com.intellij.codeInspection;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.codeInspection.java15api.Java15APIUsageInspection;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
@@ -63,11 +62,6 @@ public class JavaAPIUsagesInspectionTest extends InspectionTestCase {
|
||||
IdeaTestUtil.withLevel(getModule(), LanguageLevel.JDK_1_6, JavaAPIUsagesInspectionTest.this::doTest);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
return IdeaTestUtil.getMockJdk18();
|
||||
}
|
||||
|
||||
//generate apiXXX.txt
|
||||
/*
|
||||
//todo exclude inheritors of ConcurrentMap#putIfAbsent
|
||||
|
||||
+3
-1
@@ -38,6 +38,7 @@ import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.psi.impl.source.PsiClassImpl;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.FileTreeAccessFilter;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -62,7 +63,8 @@ public class MagicConstantInspectionTest extends InspectionTestCase {
|
||||
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
return PsiTestUtil.addJdkAnnotations(super.getTestProjectSdk());
|
||||
// has to have JFrame and sources
|
||||
return PsiTestUtil.addJdkAnnotations(IdeaTestUtil.getMockJdk17());
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.intellij.codeInspection;
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
@@ -17,6 +18,12 @@ public class RedundantCast15Test extends InspectionTestCase {
|
||||
ModuleRootModificationUtil.setModuleSdk(getModule(), getTestProjectSdk());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
// in jdk 8 some casts are unnecessary
|
||||
return IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
final LocalInspectionToolWrapper toolWrapper = new LocalInspectionToolWrapper(new RedundantCastInspection());
|
||||
doTest("redundantCast/generics/" + getTestName(false), toolWrapper, "java 1.5");
|
||||
|
||||
@@ -17,10 +17,6 @@ package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
|
||||
public class RedundantCast18Test extends InspectionTestCase {
|
||||
@@ -35,11 +31,4 @@ public class RedundantCast18Test extends InspectionTestCase {
|
||||
public void testForeachValue() throws Exception { doTest(); }
|
||||
public void testConditional() throws Exception { doTest(); }
|
||||
public void testInferApplicabilityError() throws Exception { doTest(); }
|
||||
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
Sdk sdk = IdeaTestUtil.getMockJdk17();
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
|
||||
return sdk;
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,6 @@ package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInspection.unneededThrows.RedundantThrows;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
|
||||
public class RedundantThrowTest extends InspectionTestCase {
|
||||
@@ -68,11 +64,4 @@ public class RedundantThrowTest extends InspectionTestCase {
|
||||
public void testThrownClausesInFunctionalExpressions() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
Sdk sdk = IdeaTestUtil.getMockJdk17();
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
|
||||
return sdk;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,6 @@ package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInspection.unusedReturnValue.UnusedReturnValue;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
|
||||
public class UnusedReturnValueTest extends InspectionTestCase {
|
||||
@@ -47,13 +43,6 @@ public class UnusedReturnValueTest extends InspectionTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
Sdk sdk = IdeaTestUtil.getMockJdk18();
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
|
||||
return sdk;
|
||||
}
|
||||
|
||||
public void testSimpleSetter() throws Exception {
|
||||
try {
|
||||
myTool.IGNORE_BUILDER_PATTERN = true;
|
||||
|
||||
Binary file not shown.
@@ -234,8 +234,8 @@ public abstract class InspectionTestCase extends PsiTestCase {
|
||||
}
|
||||
|
||||
protected Sdk getTestProjectSdk() {
|
||||
Sdk sdk = IdeaTestUtil.getMockJdk17();
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
|
||||
Sdk sdk = IdeaTestUtil.getMockJdk18();
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
|
||||
return sdk;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user