mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed ancient JDK-dependent community test
This commit is contained in:
+37
-1
@@ -9,6 +9,12 @@ package com.intellij.codeInspection;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.codeInspection.nullable.NullableStuffInspection;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.SdkModificator;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
|
||||
public class NullableStuffInspectionTest extends InspectionTestCase {
|
||||
@@ -26,7 +32,13 @@ public class NullableStuffInspectionTest extends InspectionTestCase {
|
||||
doTest("nullableProblems/" + getTestName(true), new LocalInspectionToolWrapper(myInspection),"java 1.5");
|
||||
}
|
||||
private void doTest14() throws Exception {
|
||||
doTest("nullableProblems/" + getTestName(true), new LocalInspectionToolWrapper(myInspection),"java 1.4");
|
||||
myExcludeAnnotations = true;
|
||||
try {
|
||||
doTest("nullableProblems/" + getTestName(true), new LocalInspectionToolWrapper(myInspection),"java 1.4");
|
||||
}
|
||||
finally {
|
||||
myExcludeAnnotations = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void testProblems() throws Exception{ doTest(); }
|
||||
@@ -38,4 +50,28 @@ public class NullableStuffInspectionTest extends InspectionTestCase {
|
||||
myInspection.REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS = true;
|
||||
doTest();
|
||||
}
|
||||
|
||||
private boolean myExcludeAnnotations = false;
|
||||
|
||||
@Override
|
||||
protected void setupRootModel(String testDir, VirtualFile[] sourceDir, String sdkName) {
|
||||
super.setupRootModel(testDir, sourceDir, sdkName);
|
||||
|
||||
if (myExcludeAnnotations) {
|
||||
final Sdk sdk = ModuleRootManager.getInstance(myModule).getSdk();
|
||||
assert sdk != null;
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
final SdkModificator sdkMod = sdk.getSdkModificator();
|
||||
for (VirtualFile file : sdkMod.getRoots(OrderRootType.CLASSES)) {
|
||||
if ("annotations.jar".equals(file.getName())) {
|
||||
sdkMod.removeRoot(file, OrderRootType.CLASSES);
|
||||
break;
|
||||
}
|
||||
}
|
||||
sdkMod.commitChanges();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user