Cleanup (unneeded language level restore)

This commit is contained in:
Roman Shevchenko
2017-03-24 13:02:31 +01:00
parent 1abffecba5
commit 05b15f593e
5 changed files with 27 additions and 41 deletions

View File

@@ -17,7 +17,6 @@ package com.intellij.codeInsight.completion;
import com.intellij.JavaTestUtil;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import org.jetbrains.annotations.NotNull;
@@ -140,18 +139,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase {
public void testIntInGenerics() { doTest(2, "int", "char", "final"); }
public void testIntInGenerics2() { doTest(2, "int", "char", "final"); }
public void testBreakInLabeledBlock() { doTest(1, "break label", "continue"); }
public void testPrivateInJava9Interface() {
LanguageLevelProjectExtension levelProjectExtension = LanguageLevelProjectExtension.getInstance(getProject());
LanguageLevel oldLevel = levelProjectExtension.getLanguageLevel();
try {
levelProjectExtension.setLanguageLevel(LanguageLevel.JDK_1_9);
doTest();
}
finally {
levelProjectExtension.setLanguageLevel(oldLevel);
}
}
public void testPrivateInJava9Interface() { setLanguageLevel(LanguageLevel.JDK_1_9); doTest(); }
public void testTryInExpression() {
configureByFile(BASE_PATH + getTestName(true) + ".java");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -293,14 +293,8 @@ public class IntroduceParameterTest extends LightRefactoringTestCase {
}
public void testDiamondOccurrences() {
final LanguageLevel oldLevel = getLanguageLevel();
try {
setLanguageLevel(LanguageLevel.JDK_1_7);
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
finally {
setLanguageLevel(oldLevel);
}
setLanguageLevel(LanguageLevel.JDK_1_7);
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
public void testPreserveDiamondOccurrences() {

View File

@@ -460,13 +460,8 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
public void testMethodRefNotInContextInferredFilterWithNonAcceptableSince() {
//though test extracts method reference which is not suppose to appear with language level 1.7
//@since 1.8 in Consumer prevent it to appear at first position
try {
setLanguageLevel(LanguageLevel.JDK_1_7);
doTest(new MockIntroduceVariableHandler("l", false, false, false, "D<java.lang.Integer>", false));
}
finally {
setLanguageLevel(getLanguageLevel());
}
setLanguageLevel(LanguageLevel.JDK_1_7);
doTest(new MockIntroduceVariableHandler("l", false, false, false, "D<java.lang.Integer>", false));
}
public void testOneLineLambdaVoidCompatible() {

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.refactoring.inline;
import com.intellij.JavaTestUtil;
@@ -188,7 +203,7 @@ public class InlineToAnonymousClassTest extends LightRefactoringTestCase {
public void testMultipleInnerClasses() throws Exception {
doTest(false, false);
}
public void testConstructorArgumentInExpression() throws Exception {
doTest(false, false);
}
@@ -242,14 +257,8 @@ public class InlineToAnonymousClassTest extends LightRefactoringTestCase {
}
public void testNoFinalForJava8() throws Exception {
final LanguageLevel languageLevel = getLanguageLevel();
try {
setLanguageLevel(LanguageLevel.HIGHEST);
doTest(true, false);
}
finally {
setLanguageLevel(languageLevel);
}
setLanguageLevel(LanguageLevel.HIGHEST);
doTest(true, false);
}
public void testNoInlineAbstract() throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ public abstract class LightCodeInsightTestCase extends LightPlatformCodeInsightT
return LanguageLevel.HIGHEST;
}
protected static void setLanguageLevel(final LanguageLevel level) {
protected void setLanguageLevel(LanguageLevel level) {
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(level);
}
@@ -55,4 +55,4 @@ public abstract class LightCodeInsightTestCase extends LightPlatformCodeInsightT
protected ModuleType getModuleType() {
return StdModuleTypes.JAVA;
}
}
}