a bombed test for IDEA-126629 java.io.Closeable is not AutoCloseable in some cases

This commit is contained in:
peter
2015-04-16 19:11:48 +03:00
parent 563643999b
commit a577297f81
3 changed files with 46 additions and 3 deletions
@@ -0,0 +1,5 @@
package p;
import java.io.FileReader;
class MyReader extends FileReader {}
@@ -0,0 +1,11 @@
package p;
class Foo {
{
try (MyReader c1 = new MyReader() {}) {
}
}
}
@@ -16,6 +16,7 @@
package com.intellij.codeInsight;
import com.intellij.idea.Bombed;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.ModifiableRootModel;
@@ -29,6 +30,8 @@ import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
import com.intellij.testFramework.fixtures.*;
import com.intellij.util.Consumer;
import java.util.Calendar;
public class MultipleJdksHighlightingTest extends UsefulTestCase {
private CodeInsightTestFixture myFixture;
@@ -69,8 +72,7 @@ public class MultipleJdksHighlightingTest extends UsefulTestCase {
ModuleRootModificationUtil.updateModel(myJava3Module, new Consumer<ModifiableRootModel>() {
@Override
public void consume(ModifiableRootModel model) {
model.addModuleOrderEntry(myJava7Module);
model.setSdk(IdeaTestUtil.getMockJdk17());
model.setSdk(IdeaTestUtil.getMockJdk14());
String contentUrl = VfsUtilCore.pathToUrl(myFixture.getTempDirPath()) + "/java3";
model.addContentEntry(contentUrl).addSourceFolder(contentUrl, false);
}
@@ -79,7 +81,6 @@ public class MultipleJdksHighlightingTest extends UsefulTestCase {
ModuleRootModificationUtil.updateModel(myJava7Module, new Consumer<ModifiableRootModel>() {
@Override
public void consume(ModifiableRootModel model) {
model.addModuleOrderEntry(myJava8Module);
model.setSdk(IdeaTestUtil.getMockJdk17());
String contentUrl = VfsUtilCore.pathToUrl(myFixture.getTempDirPath()) + "/java7";
model.addContentEntry(contentUrl).addSourceFolder(contentUrl, false);
@@ -96,11 +97,18 @@ public class MultipleJdksHighlightingTest extends UsefulTestCase {
});
}
private void addDependencies_37_78() {
ModuleRootModificationUtil.addDependency(myJava7Module, myJava8Module);
ModuleRootModificationUtil.addDependency(myJava3Module, myJava7Module);
}
public void testGetClass() throws Exception {
addDependencies_37_78();
doTest();
}
public void testWrongSuperInLibrary() throws Exception {
addDependencies_37_78();
final String name = getTestName(false);
for (Module module : new Module[] {myJava7Module, myJava8Module}) {
ModuleRootModificationUtil.updateModel(module, new Consumer<ModifiableRootModel>() {
@@ -116,42 +124,61 @@ public class MultipleJdksHighlightingTest extends UsefulTestCase {
}
public void testWrongComparator() throws Exception {
addDependencies_37_78();
doTestWithoutLibrary();
}
public void testGenericComparator() throws Exception {
addDependencies_37_78();
doTestWithoutLibrary();
}
public void testGenericCallableWithDifferentTypeArgs() throws Exception {
addDependencies_37_78();
doTestWithoutLibrary();
}
public void testSuperclassImplementsUnknownType() throws Exception {
addDependencies_37_78();
doTestWithoutLibrary();
}
public void testDeclaredTypeOfVariableImplementsUnknownType() throws Exception {
addDependencies_37_78();
doTestWithoutLibrary();
}
public void testSuperclassImplementsGenericsOfUnknownType() throws Exception {
addDependencies_37_78();
doTestWithoutLibrary();
}
public void testSuperMethodNotExist() throws Exception {
addDependencies_37_78();
doTestWithoutLibrary();
}
public void testNoOverriding() throws Exception {
addDependencies_37_78();
doTestWithoutLibrary();
}
public void testStaticCallOnChildWithNotAccessibleParent() throws Exception {
addDependencies_37_78();
doTest3Modules();
}
@Bombed(user = "peter,anna", year = 2015, month = Calendar.MAY, day = 1)
public void testCloseableAutoCloseable() {
ModuleRootModificationUtil.addDependency(myJava7Module, myJava3Module);
final String name = getTestName(false);
myFixture.copyFileToProject("java3/p/" + name + ".java");
myFixture.configureByFiles("java7/p/" + name + ".java");
myFixture.checkHighlighting();
}
public void testLanguageLevelInReturnTypeCheck() throws Exception {
addDependencies_37_78();
final String name = getTestName(false);
myFixture.configureByFiles("java3/p/" + name + ".java", "java7/p/" + name + ".java");
myFixture.checkHighlighting();