You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by sk...@apache.org on 2020/05/05 11:54:13 UTC
[netbeans] branch master updated: [NETBEANS-4283]:Code
Modifications related to finalization of Switch Expressions in JDK14
This is an automated email from the ASF dual-hosted git repository.
skygo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 95b90d5 [NETBEANS-4283]:Code Modifications related to finalization of Switch Expressions in JDK14
new 1a9cc27 Merge pull request #2124 from Mohan-Sarilla/netbeans-4283
95b90d5 is described below
commit 95b90d5e99e0d20f04e0217cfa057a7329fc8c2e
Author: Mohan-Sarilla <sa...@oracle.com>
AuthorDate: Sat May 2 18:30:50 2020 +0530
[NETBEANS-4283]:Code Modifications related to finalization of Switch Expressions in JDK14
---
.../java/hints/errors/DifferentCaseKindsFix.java | 4 +-
.../modules/java/hints/errors/Utilities.java | 8 ++
.../java/hints/jdk/ConvertSwitchToRuleSwitch.java | 7 +-
.../hints/errors/DifferentCaseKindsFixTest.java | 12 ++-
.../hints/jdk/ConvertSwitchToRuleSwitchTest.java | 87 +++++++++++++++-------
5 files changed, 88 insertions(+), 30 deletions(-)
diff --git a/java/java.hints/src/org/netbeans/modules/java/hints/errors/DifferentCaseKindsFix.java b/java/java.hints/src/org/netbeans/modules/java/hints/errors/DifferentCaseKindsFix.java
index ec75b07..5572337 100644
--- a/java/java.hints/src/org/netbeans/modules/java/hints/errors/DifferentCaseKindsFix.java
+++ b/java/java.hints/src/org/netbeans/modules/java/hints/errors/DifferentCaseKindsFix.java
@@ -44,6 +44,8 @@ import org.openide.util.NbBundle;
*/
public class DifferentCaseKindsFix implements ErrorRule<Void> {
+ private static final int SWITCH_RULE_PREVIEW_JDK_VERSION = 13;
+
private static final Set<String> ERROR_CODES = new HashSet<String>(Arrays.asList(
"compiler.err.switch.mixing.case.types")); // NOI18N
@@ -54,7 +56,7 @@ public class DifferentCaseKindsFix implements ErrorRule<Void> {
@Override
public List<Fix> run(CompilationInfo info, String diagnosticKey, int offset, TreePath treePath, Data<Void> data) {
- if (!CompilerOptionsQuery.getOptions(info.getFileObject()).getArguments().contains("--enable-preview")) {
+ if (Utilities.isJDKVersionLower(SWITCH_RULE_PREVIEW_JDK_VERSION) && !CompilerOptionsQuery.getOptions(info.getFileObject()).getArguments().contains("--enable-preview")) {
return null;
}
TreePath parentPath = treePath.getParentPath();
diff --git a/java/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java b/java/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java
index 9b8f8f9..3f70b14 100644
--- a/java/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java
+++ b/java/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java
@@ -159,6 +159,7 @@ import org.openide.util.Pair;
public class Utilities {
public static final String JAVA_MIME_TYPE = "text/x-java";
private static final String DEFAULT_NAME = "name";
+ private static final String UNDERSCORE = "_";
enum SWITCH_TYPE { TRADITIONAL_SWITCH, RULE_SWITCH, SWITCH_EXPRESSION }
public Utilities() {
@@ -3331,4 +3332,11 @@ public class Utilities {
JCTree.JCAssign assignTree = (JCTree.JCAssign) jceTree.expr;
return ((JCTree.JCIdent) assignTree.lhs).name;
}
+
+ public static boolean isJDKVersionLower(int previewUntilJDK){
+ if(Integer.valueOf(SourceVersion.latest().name().split(UNDERSCORE)[1]).compareTo(previewUntilJDK)<=0)
+ return true;
+
+ return false;
+ }
}
diff --git a/java/java.hints/src/org/netbeans/modules/java/hints/jdk/ConvertSwitchToRuleSwitch.java b/java/java.hints/src/org/netbeans/modules/java/hints/jdk/ConvertSwitchToRuleSwitch.java
index aa681f6..751f4b2 100644
--- a/java/java.hints/src/org/netbeans/modules/java/hints/jdk/ConvertSwitchToRuleSwitch.java
+++ b/java/java.hints/src/org/netbeans/modules/java/hints/jdk/ConvertSwitchToRuleSwitch.java
@@ -22,6 +22,7 @@ import com.sun.source.tree.CaseTree;
import com.sun.source.tree.SwitchTree;
import com.sun.source.tree.Tree;
import com.sun.source.util.TreePath;
+import javax.lang.model.SourceVersion;
import org.netbeans.api.java.queries.CompilerOptionsQuery;
import org.netbeans.api.java.source.CompilationInfo;
import org.netbeans.modules.java.hints.errors.Utilities;
@@ -43,11 +44,13 @@ import org.openide.util.NbBundle.Messages;
"DESC_org.netbeans.modules.java.hints.jdk.ConvertSwitchStatementToSwitchExpression=Converts to switch expression",
})
public class ConvertSwitchToRuleSwitch {
-
+
+ private static final int SWITCH_RULE_PREVIEW_JDK_VERSION = 13;
+
@TriggerTreeKind(Tree.Kind.SWITCH)
@Messages({"ERR_ConvertSwitchToRuleSwitch=Convert switch to rule switch", "ERR_ConvertSwitchToSwitchExpression=Convert to switch expression"})
public static ErrorDescription switch2RuleSwitch(HintContext ctx) {
- if (!CompilerOptionsQuery.getOptions(ctx.getInfo().getFileObject()).getArguments().contains("--enable-preview"))
+ if (Utilities.isJDKVersionLower(SWITCH_RULE_PREVIEW_JDK_VERSION) && !CompilerOptionsQuery.getOptions(ctx.getInfo().getFileObject()).getArguments().contains("--enable-preview"))
return null;
SwitchTree st = (SwitchTree) ctx.getPath().getLeaf();
boolean completesNormally = false;
diff --git a/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/errors/DifferentCaseKindsFixTest.java b/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/errors/DifferentCaseKindsFixTest.java
index b9cacff..936f8ae 100644
--- a/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/errors/DifferentCaseKindsFixTest.java
+++ b/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/errors/DifferentCaseKindsFixTest.java
@@ -22,6 +22,7 @@ import com.sun.source.util.TreePath;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import javax.lang.model.SourceVersion;
import javax.swing.event.ChangeListener;
import org.netbeans.api.java.source.CompilationInfo;
import org.netbeans.modules.java.hints.infrastructure.ErrorHintsTestBase;
@@ -47,9 +48,16 @@ public class DifferentCaseKindsFixTest extends ErrorHintsTestBase {
@Override
protected void setUp() throws Exception {
super.setUp();
- sourceLevel = "13";
JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
- EXTRA_OPTIONS.add("--enable-preview");
+ try {
+ SourceVersion.valueOf("RELEASE_14"); //NOI18N
+ } catch (IllegalArgumentException ex) {
+ //OK, no RELEASE_14, skip test
+ sourceLevel = "13";
+ EXTRA_OPTIONS.add("--enable-preview");
+ return;
+ }
+ sourceLevel = "14";
}
@ServiceProvider(service = CompilerOptionsQueryImplementation.class, position = 100)
diff --git a/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/jdk/ConvertSwitchToRuleSwitchTest.java b/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/jdk/ConvertSwitchToRuleSwitchTest.java
index 08e171d..13e3563 100644
--- a/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/jdk/ConvertSwitchToRuleSwitchTest.java
+++ b/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/jdk/ConvertSwitchToRuleSwitchTest.java
@@ -35,7 +35,19 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
super(name);
}
+ public static boolean isJDK14(){
+ try {
+ SourceVersion.valueOf("RELEASE_14"); //NOI18N
+ } catch (IllegalArgumentException ex) {
+ //OK, no RELEASE_14, skip test
+ return false;
+ }
+ return true;
+ }
+
public void testSwitch2RuleSwitch() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -49,7 +61,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToRuleSwitch())
.applyFix()
@@ -68,6 +79,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testLastNotBreak() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -79,7 +92,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToRuleSwitch())
.applyFix()
@@ -96,6 +108,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testMultipleCases() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -109,7 +123,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToRuleSwitch())
.applyFix()
@@ -127,6 +140,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testFallThrough() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -139,12 +154,13 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.assertWarnings();
}
public void testMissingLastBreak() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -158,7 +174,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToRuleSwitch())
.applyFix()
@@ -176,6 +191,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testDefault() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -188,7 +205,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToRuleSwitch())
.applyFix()
@@ -208,6 +224,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testVariables1() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -227,7 +245,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToRuleSwitch())
.applyFix()
@@ -253,6 +270,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testFallThroughDefault1() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -266,12 +285,13 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.assertWarnings();
}
public void testFallThroughDefault2() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -285,12 +305,13 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.assertWarnings();
}
public void testTrailingEmptyCase() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -306,7 +327,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToRuleSwitch())
.applyFix()
@@ -327,6 +347,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testNeedsPreview() throws Exception {
+ if(ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -346,6 +368,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testBreakInside1() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -358,12 +382,13 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.assertWarnings();
}
public void testBreakInside2() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;\n" +
"public class Test {\n" +
@@ -378,7 +403,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("4:9-4:15:verifier:Convert switch to rule switch")
.applyFix()
@@ -400,6 +424,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testContinueInside1() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;\n" +
"public class Test {\n" +
@@ -412,12 +438,13 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.assertWarnings();
}
public void testContinueInside2() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;\n" +
"public class Test {\n" +
@@ -434,7 +461,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("5:13-5:19:verifier:Convert switch to rule switch")
.applyFix()
@@ -460,6 +486,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
//Test cases for switch expression
public void testSwitch2SwitchExpression() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -474,7 +502,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToSwitchExpression())
.applyFix()
@@ -494,6 +521,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testSwitch2SwitchExpressionMultiCase() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -508,7 +537,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:8-3:14:verifier:" + Bundle.ERR_ConvertSwitchToSwitchExpression())
.applyFix()
@@ -527,6 +555,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testSwitch2SwitchExpressionMultiCase2() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -541,7 +571,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:8-3:14:verifier:" + Bundle.ERR_ConvertSwitchToSwitchExpression())
.applyFix()
@@ -560,6 +589,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testSwitch2SwitchExpressionOnlyDefault() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -571,7 +602,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:8-3:14:verifier:" + Bundle.ERR_ConvertSwitchToSwitchExpression())
.applyFix()
@@ -588,6 +618,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testSwitch2SwitchExpressionNestedInnerSwitchExpression() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -605,7 +637,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("4:9-4:15:verifier:" + Bundle.ERR_ConvertSwitchToSwitchExpression())
.applyFix()
@@ -628,6 +659,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testSwitch2SwitchExpressionReturnValue() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -639,7 +672,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("2:9-2:15:verifier:" + Bundle.ERR_ConvertSwitchToSwitchExpression())
.applyFix()
@@ -656,6 +688,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testSwitch2SwitchExpressionTypeCast() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -668,7 +702,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToSwitchExpression())
.applyFix()
@@ -686,6 +719,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testSwitch2SwitchExpressionTypeCastReturn() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -697,7 +732,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("2:9-2:15:verifier:" + Bundle.ERR_ConvertSwitchToSwitchExpression())
.applyFix()
@@ -714,6 +748,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testSwitch2SwitchExpressionNestedSwitchExpression() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -729,7 +765,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToSwitchExpression())
.applyFix()
@@ -750,6 +785,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testSwitch2SwitchExpressionNestedOuterSwitchStatement() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -770,7 +807,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("4:9-4:15:verifier:" + Bundle.ERR_ConvertSwitchToRuleSwitch())
.applyFix()
@@ -794,6 +830,8 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
}
public void testSwitch2SwitchExpressionNestedInnerSwitchStatement() throws Exception {
+ if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+ return;
HintTest.create()
.input("package test;" +
"public class Test {\n" +
@@ -814,7 +852,6 @@ public class ConvertSwitchToRuleSwitchTest extends NbTestCase {
" }\n" +
"}\n")
.sourceLevel(SourceVersion.latest().name())
- .options("--enable-preview")
.run(ConvertSwitchToRuleSwitch.class)
.findWarning("6:16-6:22:verifier:" + Bundle.ERR_ConvertSwitchToSwitchExpression())
.applyFix()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists