language level 15, remove 13 preview

GitOrigin-RevId: 5e0277b784e6dfa59ad4eca16688bc3a40c04d60
This commit is contained in:
Anna Kozlova
2020-06-09 20:53:00 +03:00
committed by intellij-monorepo-bot
parent c6e824e253
commit 60f4542cda
71 changed files with 64 additions and 304 deletions
@@ -113,7 +113,6 @@ feature.enhanced.switch=Enhanced 'switch' blocks
feature.switch.expressions='switch' expressions
feature.records=Records
feature.patterns.instanceof=Patterns in 'instanceof'
feature.text.block.escape.sequences='\\s' and '\\' escape sequences
find.searching.for.references.to.class.progress=Searching for references to class {0}...
find.usages.panel.title.derived.classes=Derived Classes
@@ -1218,13 +1218,13 @@ public class HighlightUtil {
}
else {
if (file != null && containsUnescaped(text, "\\\n")) {
final HighlightInfo info = checkFeature(expression, HighlightingFeature.TEXT_BLOCK_ESCAPES, level, file);
final HighlightInfo info = checkFeature(expression, HighlightingFeature.TEXT_BLOCKS, level, file);
if (info != null) return info;
}
}
}
if (file != null && containsUnescaped(text, "\\s")) {
final HighlightInfo info = checkFeature(expression, HighlightingFeature.TEXT_BLOCK_ESCAPES, level, file);
final HighlightInfo info = checkFeature(expression, HighlightingFeature.TEXT_BLOCKS, level, file);
if (info != null) return info;
}
}
@@ -32,32 +32,16 @@ public enum HighlightingFeature {
MODULES(LanguageLevel.JDK_1_9, "feature.modules"),
LVTI(LanguageLevel.JDK_10, "feature.lvti"),
VAR_LAMBDA_PARAMETER(LanguageLevel.JDK_11, "feature.var.lambda.parameter"),
ENHANCED_SWITCH(LanguageLevel.JDK_13_PREVIEW, "feature.enhanced.switch"){
@Override
boolean isSufficient(@NotNull LanguageLevel useSiteLevel) {
return useSiteLevel.isAtLeast(LanguageLevel.JDK_13_PREVIEW);//enabled in jdk 14 as standard
}
@Override
LanguageLevel getStandardLevel() {
return LanguageLevel.JDK_14;
}
},
SWITCH_EXPRESSION(LanguageLevel.JDK_13_PREVIEW, "feature.switch.expressions") {
@Override
boolean isSufficient(@NotNull LanguageLevel useSiteLevel) {
return useSiteLevel.isAtLeast(LanguageLevel.JDK_13_PREVIEW);//enabled in jdk 14 as standard
}
@Override
LanguageLevel getStandardLevel() {
return LanguageLevel.JDK_14;
}
},
TEXT_BLOCKS(LanguageLevel.JDK_13_PREVIEW, "feature.text.blocks"),
ENHANCED_SWITCH(LanguageLevel.JDK_14, "feature.enhanced.switch"),
SWITCH_EXPRESSION(LanguageLevel.JDK_14, "feature.switch.expressions"),
RECORDS(LanguageLevel.JDK_14_PREVIEW, "feature.records"),
PATTERNS(LanguageLevel.JDK_14_PREVIEW, "feature.patterns.instanceof"),
TEXT_BLOCK_ESCAPES(LanguageLevel.JDK_14_PREVIEW, "feature.text.block.escape.sequences");
TEXT_BLOCKS(LanguageLevel.JDK_14_PREVIEW, "feature.text.blocks") {
@Override
boolean isSufficient(@NotNull LanguageLevel useSiteLevel) {
return useSiteLevel.isAtLeast(LanguageLevel.JDK_14_PREVIEW);
}
};
final LanguageLevel level;
@PropertyKey(resourceBundle = JavaErrorBundle.BUNDLE)
@@ -823,7 +823,7 @@ public class JavaKeywordCompletion {
addKeyword(br);
}
else if (psiElement().inside(PsiSwitchExpression.class).accepts(myPosition) &&
PsiUtil.getLanguageLevel(myPosition).isAtLeast(LanguageLevel.JDK_13_PREVIEW)) {
PsiUtil.getLanguageLevel(myPosition).isAtLeast(LanguageLevel.JDK_14)) {
addKeyword(TailTypeDecorator.withTail(createKeyword(PsiKeyword.YIELD), TailType.INSERT_SPACE));
}
@@ -121,6 +121,8 @@ jdk.13.language.level.description=13 - No new language features
jdk.13.preview.language.level.description=13 (Preview) - Switch expressions, text blocks
jdk.14.language.level.description=14 - Switch expressions
jdk.14.preview.language.level.description=14 (Preview) - Records, patterns, text blocks
jdk.15.language.level.description=15 - Text blocks
jdk.15.preview.language.level.description=15 (Preview) - Sealed types
jdk.X.language.level.description=X - Experimental features
local.class.preposition=local
@@ -28,7 +28,8 @@ public enum JavaSdkVersion {
JDK_12(LanguageLevel.JDK_12),
JDK_13(LanguageLevel.JDK_13),
JDK_14(LanguageLevel.JDK_14),
JDK_15(LanguageLevel.JDK_X);
JDK_15(LanguageLevel.JDK_15),
JDK_16(LanguageLevel.JDK_X);
private final LanguageLevel myMaxLanguageLevel;
@@ -33,10 +33,12 @@ public enum LanguageLevel {
JDK_11(JavaPsiBundle.message("jdk.11.language.level.description"), 11),
JDK_12(JavaPsiBundle.message("jdk.12.language.level.description"), 12),
JDK_13(JavaPsiBundle.message("jdk.13.language.level.description"), 13),
JDK_13_PREVIEW(JavaPsiBundle.message("jdk.13.preview.language.level.description"), 13),
JDK_14(JavaPsiBundle.message("jdk.14.language.level.description"), 14),
JDK_14_PREVIEW(JavaPsiBundle.message("jdk.14.preview.language.level.description"), 14),
JDK_X(JavaPsiBundle.message("jdk.X.language.level.description"), 15);
JDK_15(JavaPsiBundle.message("jdk.15.language.level.description"), 15),
JDK_15_PREVIEW(JavaPsiBundle.message("jdk.15.preview.language.level.description"), 15),
JDK_X(JavaPsiBundle.message("jdk.X.language.level.description"), 16);
public static final LanguageLevel HIGHEST = JDK_14;
public static final Key<LanguageLevel> KEY = Key.create("LANGUAGE_LEVEL");
@@ -41,7 +41,7 @@ public class JavaLexer extends LexerBase {
return id != null &&
(level.isAtLeast(LanguageLevel.JDK_1_9) && JAVA9_KEYWORDS.contains(id) ||
level.isAtLeast(LanguageLevel.JDK_10) && VAR.contentEquals(id) ||
level.isAtLeast(LanguageLevel.JDK_13_PREVIEW) && YIELD.contentEquals(id) ||
level.isAtLeast(LanguageLevel.JDK_14) && YIELD.contentEquals(id) ||
level.isAtLeast(LanguageLevel.JDK_14_PREVIEW) && RECORD.contentEquals(id));
}
@@ -120,7 +120,7 @@ public class StatementParser {
}
else if (tokenType == JavaTokenType.IDENTIFIER &&
PsiKeyword.YIELD.equals(builder.getTokenText()) &&
getLanguageLevel(builder).isAtLeast(LanguageLevel.JDK_13_PREVIEW)) {
getLanguageLevel(builder).isAtLeast(LanguageLevel.JDK_14)) {
return parseYieldStatement(builder);
}
else if (tokenType == JavaTokenType.CONTINUE_KEYWORD) {
@@ -23,6 +23,6 @@ class UnsupportedFeatures {
String raw = <error descr="Text block literals are not supported at language level '1.4'">"""hi there"""</error>;
String spaceEscapeSeq = <error descr="'\s' and '\' escape sequences are not supported at language level '1.4'">"\s"</error>;
String spaceEscapeSeq = <error descr="Text block literals are not supported at language level '1.4'">"\s"</error>;
}
}
@@ -6,11 +6,11 @@ import groovy.transform.CompileStatic
import org.jetbrains.annotations.NotNull
@CompileStatic
class Normal13CompletionTest extends NormalCompletionTestCase {
class NormalSwitchCompletionTest extends NormalCompletionTestCase {
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13
return JAVA_14
}
void testDefaultInRuleSwitch() { doTest() }
@@ -6,7 +6,7 @@ import com.intellij.codeInspection.redundantCast.RedundantCastInspection
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
class JavaSwitchExpressionsHighlightingTest : LightJavaCodeInsightFixtureTestCase() {
override fun getProjectDescriptor() = JAVA_13
override fun getProjectDescriptor() = JAVA_14
override fun getBasePath() = "${JavaTestUtil.getRelativeJavaTestDataPath()}/codeInsight/daemonCodeAnalyzer/switchExpressions"
fun testEnhancedSwitchStatements() = doTest()
@@ -5,13 +5,13 @@ import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase.JAVA_13;
public class JavaTextBlockIndentGuidePerformanceTest extends LightDaemonAnalyzerTestCase {
@NotNull
@@ -35,7 +35,7 @@ public class JavaTextBlockIndentGuidePerformanceTest extends LightDaemonAnalyzer
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
return LightJavaCodeInsightFixtureTestCase.JAVA_14;
}
private static String createCodeBlocks(int n, int nLines) {
@@ -113,7 +113,7 @@ public class JavaTextBlockIndentGuideTest extends BaseIndentGuideTest {
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
return JAVA_14;
}
private void doTest(@NotNull String text) {
@@ -2,19 +2,9 @@
package com.intellij.java.codeInsight.daemon.quickFix;
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
import com.intellij.testFramework.LightProjectDescriptor;
import org.jetbrains.annotations.NotNull;
import static com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase.JAVA_13;
public class WrapSwitchRuleStatementsIntoBlockFixTest extends LightQuickFixParameterizedTestCase {
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
@Override
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/wrapSwitchRuleStatements";
@@ -36,7 +36,7 @@ class JavaQuoteTest extends LightJavaCodeInsightFixtureTestCase {
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13
return JAVA_14
}
private void doTest(String before, String after, char c = '"') {
@@ -13,7 +13,7 @@ import com.intellij.util.containers.ContainerUtil
class JavaSurroundWith13Test : LightJavaCodeInsightTestCase() {
private val BASE_PATH = "/codeInsight/generation/surroundWith/java13/"
override fun getProjectDescriptor(): LightProjectDescriptor = JavaFoldingTestCase.JAVA_13
override fun getProjectDescriptor(): LightProjectDescriptor = JavaFoldingTestCase.JAVA_14
fun testCaseBlockWithIf() = doTest(JavaWithIfSurrounder())
fun testCaseResultWithIf() = doTest(JavaWithIfSurrounder())
@@ -101,7 +101,7 @@ class HighlightUsagesHandlerTest extends LightJavaCodeInsightFixtureTestCase {
}
void testBreakInSwitchExpr() {
IdeaTestUtil.withLevel module, LanguageLevel.JDK_13_PREVIEW, {
IdeaTestUtil.withLevel module, LanguageLevel.JDK_14, {
configureFile()
ctrlShiftF7()
assertRangeText 'switch', 'yield', 'yield'
@@ -2,10 +2,7 @@
package com.intellij.java.codeInsight.intention;
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
import com.intellij.testFramework.LightProjectDescriptor;
import org.jetbrains.annotations.NotNull;
import static com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase.JAVA_13;
public class SplitSwitchBranchWithSeveralCaseValuesTest extends LightQuickFixParameterizedTestCase {
@@ -14,12 +11,6 @@ public class SplitSwitchBranchWithSeveralCaseValuesTest extends LightQuickFixPar
return "/codeInsight/daemonCodeAnalyzer/quickFix/splitSwitchBranchWithSeveralCaseValues";
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
@Override
protected boolean shouldBeAvailableAfterExecution() {
return false;
@@ -25,7 +25,7 @@ class JavaLiveTemplateTest extends LiveTemplateTestCase {
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13
return JAVA_14
}
final String basePath = JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/template/"
@@ -1,7 +1,6 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.java.codeInsight.template.postfix.templates;
import com.intellij.testFramework.LightProjectDescriptor;
import org.jetbrains.annotations.NotNull;
public class SwitchExpressionPostfixTemplateTest extends PostfixTemplateTestCase {
@@ -11,12 +10,6 @@ public class SwitchExpressionPostfixTemplateTest extends PostfixTemplateTestCase
return "switch";
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
public void testIntExprInit() {
doTest();
}
@@ -4,8 +4,6 @@ package com.intellij.java.codeInspection
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase
import com.intellij.codeInspection.DuplicateBranchesInSwitchInspection
import com.intellij.codeInspection.LocalInspectionTool
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
/**
* @author Pavel.Dolgov
@@ -16,5 +14,4 @@ class DuplicateBranchesInEnhancedSwitchFixTest : LightQuickFixParameterizedTestC
override fun getBasePath() = "/inspection/duplicateBranchesInEnhancedSwitchFix"
override fun getProjectDescriptor(): LightProjectDescriptor = LightJavaCodeInsightFixtureTestCase.JAVA_13
}
@@ -3,7 +3,6 @@ package com.intellij.java.codeInspection
import com.intellij.JavaTestUtil
import com.intellij.codeInspection.DuplicateBranchesInSwitchInspection
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
/**
@@ -11,7 +10,6 @@ import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
*/
class DuplicateBranchesInEnhancedSwitchTest : LightJavaCodeInsightFixtureTestCase() {
override fun getBasePath() = JavaTestUtil.getRelativeJavaTestDataPath() + "/inspection/duplicateBranchesInEnhancedSwitch"
override fun getProjectDescriptor(): LightProjectDescriptor = JAVA_13
fun testSimpleExpression() = doTest()
fun testSimpleStatement() = doTest()
@@ -20,6 +20,6 @@ public class EnhancedSwitchBackwardMigrationInspectionTest extends LightQuickFix
@Override
protected LanguageLevel getLanguageLevel() {
return LanguageLevel.JDK_13_PREVIEW;
return LanguageLevel.JDK_14;
}
}
@@ -22,6 +22,6 @@ public class EnhancedSwitchMigrationInspectionTest extends LightQuickFixParamete
@Override
protected LanguageLevel getLanguageLevel() {
return LanguageLevel.JDK_13_PREVIEW;
return LanguageLevel.JDK_14;
}
}
@@ -4,8 +4,6 @@ package com.intellij.java.codeInspection;
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.ManualMinMaxCalculationInspection;
import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
import org.jetbrains.annotations.NotNull;
/**
@@ -22,9 +20,4 @@ public class ManualMinMaxCalculationInspectionTest extends LightQuickFixParamete
return "/inspection/manualMinMaxCalculation";
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return LightJavaCodeInsightFixtureTestCase.JAVA_13;
}
}
@@ -4,8 +4,6 @@ package com.intellij.java.codeInspection.enhancedSwitch
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase
import com.intellij.codeInspection.LocalInspectionTool
import com.intellij.codeInspection.enhancedSwitch.RedundantLabeledSwitchRuleCodeBlockInspection
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
/**
* @author Pavel.Dolgov
@@ -13,7 +11,6 @@ import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
class RedundantLabeledSwitchRuleCodeBlockFixTest : LightQuickFixParameterizedTestCase() {
override fun configureLocalInspectionTools(): Array<LocalInspectionTool> = arrayOf(RedundantLabeledSwitchRuleCodeBlockInspection())
override fun getProjectDescriptor(): LightProjectDescriptor = LightJavaCodeInsightFixtureTestCase.JAVA_13
override fun getBasePath() = "/inspection/redundantLabeledSwitchRuleCodeBlockFix"
}
@@ -3,7 +3,6 @@ package com.intellij.java.codeInspection.enhancedSwitch
import com.intellij.JavaTestUtil
import com.intellij.codeInspection.enhancedSwitch.RedundantLabeledSwitchRuleCodeBlockInspection
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
/**
@@ -14,9 +13,7 @@ class RedundantLabeledSwitchRuleCodeBlockTest : LightJavaCodeInsightFixtureTest
super.setUp()
myFixture.enableInspections(RedundantLabeledSwitchRuleCodeBlockInspection())
}
override fun getProjectDescriptor(): LightProjectDescriptor = JAVA_13
override fun getBasePath() = JavaTestUtil.getRelativeJavaTestDataPath() + "/inspection/redundantLabeledSwitchRuleCodeBlock"
fun testInExpression() = doTest()
@@ -4,8 +4,6 @@ package com.intellij.java.codeInspection.enhancedSwitch
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase
import com.intellij.codeInspection.LocalInspectionTool
import com.intellij.codeInspection.enhancedSwitch.SwitchLabeledRuleCanBeCodeBlockInspection
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
/**
* @author Pavel.Dolgov
@@ -13,8 +11,6 @@ import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
class SwitchLabeledRuleCanBeCodeBlockFixTest : LightQuickFixParameterizedTestCase() {
override fun configureLocalInspectionTools(): Array<LocalInspectionTool> = arrayOf(SwitchLabeledRuleCanBeCodeBlockInspection())
override fun getProjectDescriptor(): LightProjectDescriptor = LightJavaCodeInsightFixtureTestCase.JAVA_13
override fun getBasePath() = "/inspection/switchLabeledRuleCanBeCodeBlockFix"
}
@@ -6,14 +6,12 @@ import com.intellij.codeHighlighting.HighlightDisplayLevel
import com.intellij.codeInsight.daemon.HighlightDisplayKey
import com.intellij.codeInspection.enhancedSwitch.SwitchLabeledRuleCanBeCodeBlockInspection
import com.intellij.profile.codeInspection.ProjectInspectionProfileManager
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
/**
* @author Pavel.Dolgov
*/
class SwitchLabeledRuleCanBeCodeBlockTest : LightJavaCodeInsightFixtureTestCase() {
override fun getProjectDescriptor(): LightProjectDescriptor = JAVA_13
override fun getBasePath() = JavaTestUtil.getRelativeJavaTestDataPath() + "/inspection/switchLabeledRuleCanBeCodeBlock"
fun testInExpression() = doTest()
@@ -111,15 +111,15 @@ public class JavaParametersTest extends ModuleRootManagerTestCase {
public void testPreviewLanguageFeatures() throws CantRunException {
ModuleRootModificationUtil.updateModel(myModule, (model) -> {
model.getModuleExtension(LanguageLevelModuleExtension.class)
.setLanguageLevel(LanguageLevel.JDK_13_PREVIEW);
model.setSdk(IdeaTestUtil.getMockJdk(JavaVersion.compose(13)));
.setLanguageLevel(LanguageLevel.JDK_14_PREVIEW);
model.setSdk(IdeaTestUtil.getMockJdk(JavaVersion.compose(14)));
});
JavaParameters javaParameters = new JavaParameters();
javaParameters.configureByModule(myModule, JavaParameters.CLASSES_AND_TESTS);
assertTrue(javaParameters.getVMParametersList().hasParameter(JavaParameters.JAVA_ENABLE_PREVIEW_PROPERTY));
ModuleRootModificationUtil.updateModel(myModule, (model) -> model.getModuleExtension(LanguageLevelModuleExtension.class)
.setLanguageLevel(LanguageLevel.JDK_12));
.setLanguageLevel(LanguageLevel.JDK_14));
javaParameters = new JavaParameters();
javaParameters.configureByModule(myModule, JavaParameters.CLASSES_AND_TESTS);
assertFalse(javaParameters.getVMParametersList().hasParameter(JavaParameters.JAVA_ENABLE_PREVIEW_PROPERTY));
@@ -71,7 +71,7 @@ public abstract class LightJavaCodeInsightFixtureTestCase extends UsefulTestCase
public static final @NotNull LightProjectDescriptor JAVA_10_ANNOTATED = new ProjectDescriptor(LanguageLevel.JDK_10, true);
public static final @NotNull LightProjectDescriptor JAVA_11 = new ProjectDescriptor(LanguageLevel.JDK_11);
public static final @NotNull LightProjectDescriptor JAVA_12 = new ProjectDescriptor(LanguageLevel.JDK_12);
public static final @NotNull LightProjectDescriptor JAVA_13 = new ProjectDescriptor(LanguageLevel.JDK_13_PREVIEW);
public static final @NotNull LightProjectDescriptor JAVA_13 = new ProjectDescriptor(LanguageLevel.JDK_13);
public static final @NotNull LightProjectDescriptor JAVA_14 = new ProjectDescriptor(LanguageLevel.JDK_14_PREVIEW);
public static final @NotNull LightProjectDescriptor JAVA_X = new ProjectDescriptor(LanguageLevel.JDK_X);
@@ -18,9 +18,10 @@ public enum LanguageLevel {
JDK_10(10),
JDK_11(11),
JDK_12(12),
JDK_13(13), JDK_13_PREVIEW(13),
JDK_13(13),
JDK_14(14), JDK_14_PREVIEW(14),
JDK_X(15);
JDK_15(15), JDK_15_PREVIEW(15),
JDK_X(16);
public static final LanguageLevel HIGHEST = JDK_14;
@@ -40,7 +40,7 @@ public class IOResourceInspectionTest extends LightJavaInspectionTestCase {
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
return JAVA_14;
}
@Override
@@ -2,9 +2,7 @@
package com.siyeh.ig.assignment;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
public class NestedAssignmentInspectionTest extends LightJavaInspectionTestCase {
@@ -34,9 +32,4 @@ public class NestedAssignmentInspectionTest extends LightJavaInspectionTestCase
return new NestedAssignmentInspection();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
}
@@ -32,7 +32,7 @@ class IgnoreResultOfCallInspectionTest extends LightJavaInspectionTestCase {
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13
return JAVA_14
}
@Override
@@ -16,9 +16,7 @@
package com.siyeh.ig.bugs;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -37,10 +35,4 @@ public class ResultOfObjectAllocationIgnoredInspectionTest extends LightJavaInsp
inspection.ignoredClasses.add("java.util.ArrayList");
return inspection;
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
}
@@ -2,9 +2,7 @@
package com.siyeh.ig.bugs;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -44,12 +42,6 @@ public class TextLabelInSwitchStatementInspectionTest extends LightJavaInspectio
return new TextLabelInSwitchStatementInspection();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
@Override
protected String[] getEnvironmentClasses() {
return new String[] {
@@ -2,9 +2,7 @@
package com.siyeh.ig.bugs;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class ThrowableInstanceNeverThrownInspectionTest extends LightJavaInspectionTestCase {
@@ -18,12 +16,6 @@ public class ThrowableInstanceNeverThrownInspectionTest extends LightJavaInspect
return new ThrowableNotThrownInspection();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
@Override
protected String getBasePath() {
return "/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/throwable_instance_never_thrown";
@@ -2,10 +2,8 @@
package com.siyeh.ig.controlflow;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -32,9 +30,4 @@ public class BreakStatementInspectionTest extends LightJavaInspectionTestCase {
return new BreakStatementInspection();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
}
@@ -21,6 +21,6 @@ public class ConditionalExpressionWithIdenticalBranchesInspectionTest extends Li
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
return JAVA_14;
}
}
@@ -2,9 +2,7 @@
package com.siyeh.ig.controlflow;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class DefaultNotLastCaseInSwitchInspectionTest extends LightJavaInspectionTestCase {
@@ -12,12 +10,6 @@ public class DefaultNotLastCaseInSwitchInspectionTest extends LightJavaInspectio
doTest();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
@Nullable
@Override
protected InspectionProfileEntry getInspection() {
@@ -16,9 +16,7 @@
package com.siyeh.ig.controlflow;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -151,7 +149,7 @@ public class EnumSwitchStatementWhichMissesCasesInspectionTest extends LightJava
"}");
}
public void testJava13Preview() {
public void testJava14() {
doTest("enum E {A, B, C}\n" +
"\n" +
"class X {\n" +
@@ -176,11 +174,6 @@ public class EnumSwitchStatementWhichMissesCasesInspectionTest extends LightJava
"}");
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
@Nullable
@Override
@@ -2,9 +2,7 @@
package com.siyeh.ig.controlflow;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class NestedSwitchInspectionTest extends LightJavaInspectionTestCase {
@@ -12,13 +10,7 @@ public class NestedSwitchInspectionTest extends LightJavaInspectionTestCase {
public void testNestedSwitch() {
doTest();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
@Nullable
@Override
protected InspectionProfileEntry getInspection() {
@@ -2,9 +2,7 @@
package com.siyeh.ig.controlflow;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class SwitchStatementDensityInspectionTest extends LightJavaInspectionTestCase {
@@ -18,9 +16,4 @@ public class SwitchStatementDensityInspectionTest extends LightJavaInspectionTes
return new SwitchStatementDensityInspection();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
}
@@ -2,9 +2,7 @@
package com.siyeh.ig.controlflow;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class SwitchStatementWithConfusingDeclarationInspectionTest extends LightJavaInspectionTestCase {
@@ -18,9 +16,4 @@ public class SwitchStatementWithConfusingDeclarationInspectionTest extends Light
return new SwitchStatementWithConfusingDeclarationInspection();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
}
@@ -16,9 +16,7 @@
package com.siyeh.ig.controlflow;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class SwitchStatementWithTooFewBranchesInspectionTest extends LightJavaInspectionTestCase {
@@ -27,11 +25,6 @@ public class SwitchStatementWithTooFewBranchesInspectionTest extends LightJavaIn
doTest();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
@Nullable
@Override
@@ -2,9 +2,7 @@
package com.siyeh.ig.controlflow;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -110,12 +108,6 @@ public class SwitchStatementWithTooManyBranchesInspectionTest extends LightJavaI
" }");
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
@Nullable
@Override
protected InspectionProfileEntry getInspection() {
@@ -16,9 +16,7 @@
package com.siyeh.ig.controlflow;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class SwitchStatementsWithoutDefaultInspectionTest extends LightJavaInspectionTestCase {
@@ -26,13 +24,7 @@ public class SwitchStatementsWithoutDefaultInspectionTest extends LightJavaInspe
public void testSwitchStatementsWithoutDefault() {
doTest();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
@Nullable
@Override
protected InspectionProfileEntry getInspection() {
@@ -16,9 +16,7 @@
package com.siyeh.ig.controlflow;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -30,12 +28,6 @@ public class UnnecessaryBreakInspectionTest extends LightJavaInspectionTestCase
doTest();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
@Nullable
@Override
protected InspectionProfileEntry getInspection() {
@@ -1,10 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.siyeh.ig.controlflow;
import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
public class UnnecessaryContinueInspectionTest extends LightJavaCodeInsightFixtureTestCase {
@Override
@@ -12,12 +10,6 @@ public class UnnecessaryContinueInspectionTest extends LightJavaCodeInsightFixtu
return LightJavaInspectionTestCase.INSPECTION_GADGETS_TEST_DATA_PATH + "com/siyeh/igtest/controlflow/unnecessary_continue";
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
private void doTest() {
UnnecessaryContinueInspection inspection = new UnnecessaryContinueInspection();
inspection.ignoreInThenBranch = true;
@@ -2,9 +2,7 @@
package com.siyeh.ig.controlflow;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -99,9 +97,4 @@ public class UnnecessaryDefaultInspectionTest extends LightJavaInspectionTestCas
return inspection;
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
}
@@ -1,10 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.siyeh.ig.controlflow;
import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
public class UnnecessaryReturnInspectionTest extends LightJavaCodeInsightFixtureTestCase {
@Override
@@ -12,12 +10,6 @@ public class UnnecessaryReturnInspectionTest extends LightJavaCodeInsightFixture
return LightJavaInspectionTestCase.INSPECTION_GADGETS_TEST_DATA_PATH + "com/siyeh/igtest/controlflow/unnecessary_return";
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
private void doTest() {
UnnecessaryReturnInspection inspection = new UnnecessaryReturnInspection();
inspection.ignoreInThenBranch = true;
@@ -2,9 +2,7 @@
package com.siyeh.ig.dataflow;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
public class UnnecessaryLocalVariableInspectionTest extends LightJavaInspectionTestCase {
@Override
@@ -17,10 +15,4 @@ public class UnnecessaryLocalVariableInspectionTest extends LightJavaInspectionT
public void testTree() { doTest(); }
public void testSwitchExpression() { doTest(); }
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
}
@@ -60,6 +60,6 @@ public class ConditionalExpressionFixTest extends IGQuickFixesTestCase {
@Override
protected void tuneFixture(JavaModuleFixtureBuilder builder) {
builder.setLanguageLevel(LanguageLevel.JDK_13_PREVIEW);
builder.setLanguageLevel(LanguageLevel.JDK_14);
}
}
@@ -18,7 +18,7 @@ public class MakeDefaultCaseLastFixTest extends IGQuickFixesTestCase {
@Override
protected void tuneFixture(JavaModuleFixtureBuilder builder) throws Exception {
super.tuneFixture(builder);
builder.setLanguageLevel(LanguageLevel.JDK_13_PREVIEW);
builder.setLanguageLevel(LanguageLevel.JDK_14);
}
public void testLabeledSwitchRule() { doTest(); }
@@ -2,9 +2,7 @@
package com.siyeh.ig.initialization;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
public class InstanceVariableUninitializedUseInspectionTest extends LightJavaInspectionTestCase {
@Override
@@ -12,11 +10,5 @@ public class InstanceVariableUninitializedUseInspectionTest extends LightJavaIns
return new InstanceVariableUninitializedUseInspection();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
public void testInstanceVariableUninitializedUse() { doTest(); }
}
@@ -2,9 +2,7 @@
package com.siyeh.ig.jdk;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class AutoBoxingInspectionTest extends LightJavaInspectionTestCase {
@@ -19,9 +17,4 @@ public class AutoBoxingInspectionTest extends LightJavaInspectionTestCase {
return new AutoBoxingInspection();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
}
@@ -2,9 +2,7 @@
package com.siyeh.ig.jdk;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class AutoUnboxingInspectionTest extends LightJavaInspectionTestCase {
@@ -19,9 +17,4 @@ public class AutoUnboxingInspectionTest extends LightJavaInspectionTestCase {
return new AutoUnboxingInspection();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
}
@@ -4,17 +4,10 @@
package com.siyeh.ig.migration;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class UnnecessaryBoxingInspectionTest extends LightJavaInspectionTestCase {
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
public void testUnnecessaryBoxing() {
doTest();
@@ -18,7 +18,7 @@ public class UnnecessaryParenthesesInspectionTest extends LightJavaCodeInsightFi
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
return JAVA_14;
}
public void testUnnecessaryParenthesesInspection() {
@@ -2,9 +2,7 @@
package com.siyeh.ig.style;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -22,9 +20,4 @@ public class UnqualifiedStaticUsageInspectionTest extends LightJavaInspectionTes
return new UnqualifiedStaticUsageInspection();
}
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
}
}
@@ -80,6 +80,6 @@ public class ReplaceWithMutableCollectionIntentionTest extends IPPTestCase {
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
return JAVA_14;
}
}
@@ -39,6 +39,6 @@ public class MakeCallChainIntoCallSequenceTest extends IPPTestCase {
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
return JAVA_14;
}
}
@@ -54,6 +54,6 @@ public class ExtractIncrementAndDecrementTest extends IPPTestCase {
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_13;
return JAVA_14;
}
}
@@ -103,18 +103,18 @@ public class GradleMiscImportingTest extends GradleJavaImportingTestCase {
public void testPreviewLanguageLevel() throws Exception {
importProject(
"apply plugin: 'java'\n" +
"sourceCompatibility = 13\n" +
"sourceCompatibility = 14\n" +
"apply plugin: 'java'\n" +
"compileTestJava {\n" +
" sourceCompatibility = 13\n" +
" sourceCompatibility = 14\n" +
" options.compilerArgs << '--enable-preview'" +
"}\n"
);
assertModules("project", "project.main", "project.test");
assertEquals(LanguageLevel.JDK_13, getLanguageLevelForModule("project"));
assertEquals(LanguageLevel.JDK_13, getLanguageLevelForModule("project.main"));
assertEquals(LanguageLevel.JDK_13_PREVIEW, getLanguageLevelForModule("project.test"));
assertEquals(LanguageLevel.JDK_14, getLanguageLevelForModule("project"));
assertEquals(LanguageLevel.JDK_14, getLanguageLevelForModule("project.main"));
assertEquals(LanguageLevel.JDK_14_PREVIEW, getLanguageLevelForModule("project.test"));
}
@Test
@@ -186,7 +186,7 @@ public class MavenProjectModelModifierTest extends MavenDomWithIndicesTestCase {
waitUntilImported(result);
assertEquals(LanguageLevel.JDK_1_8, EffectiveLanguageLevelUtil.getEffectiveLanguageLevel(module));
getExtension().changeLanguageLevel(module, LanguageLevel.JDK_13_PREVIEW);
getExtension().changeLanguageLevel(module, LanguageLevel.JDK_14_PREVIEW);
assertEquals("--enable-preview",
findTag("project.build.plugins.plugin")
.findFirstSubTag("configuration")
@@ -871,7 +871,7 @@ public class StructureImportingTest extends MavenImportingTestCase {
" <artifactId>maven-compiler-plugin</artifactId>\n" +
" <version>3.8.0</version>\n" +
" <configuration>\n" +
" <release>13</release>\n" +
" <release>14</release>\n" +
compilerArgs +
" <forceJavacCompilerUse>true</forceJavacCompilerUse>\n" +
" </configuration>\n" +
@@ -880,7 +880,7 @@ public class StructureImportingTest extends MavenImportingTestCase {
"</build>");
assertModules("project");
assertEquals(LanguageLevel.JDK_13_PREVIEW, getLanguageLevelForModule());
assertEquals(LanguageLevel.JDK_14_PREVIEW, getLanguageLevelForModule());
}
public void testInheritingLanguageLevelFromPluginManagementSection() {
@@ -151,7 +151,7 @@ class JavaUJumpExpressionTest : JavaUJumpExpressionBase() {
class Java13UJumpExpressionTest : JavaUJumpExpressionBase() {
override fun getProjectDescriptor(): LightProjectDescriptor {
return JAVA_13
return JAVA_14
}
fun `test break in switch`() = doTest<UYieldExpression, JavaUSwitchExpression>("""
@@ -2,7 +2,6 @@
package org.jetbrains.uast.test.java
import com.intellij.psi.PsiMethod
import com.intellij.testFramework.LightProjectDescriptor
import org.jetbrains.uast.UParameter
import org.jetbrains.uast.UVariable
import org.jetbrains.uast.evaluation.SimpleEvaluatorExtension
@@ -11,8 +10,6 @@ import org.jetbrains.uast.values.UValue
import org.junit.Test
class JavaValuesTest : AbstractJavaValuesTest() {
override fun getProjectDescriptor(): LightProjectDescriptor = JAVA_13
@Test
fun testAliveThenElse() = doTest("Simple/AliveThenElse.java")
@@ -1,12 +1,9 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.uast.test.java
import com.intellij.testFramework.LightProjectDescriptor
import org.junit.Test
class SimpleJavaRenderLogTest : AbstractJavaRenderLogTest() {
override fun getProjectDescriptor(): LightProjectDescriptor = JAVA_13
@Test
fun testDataClass() = doTest("DataClass/DataClass.java")