Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-02-08 23:02:17 +0000
committerManoj Palat2019-02-08 23:02:17 +0000
commita99fc26ff94745bbcda6366c6cba02d85aeb2315 (patch)
treeca3ea9820d84a9faf51a051a567aae8225230d26 /org.eclipse.jdt.core.tests.compiler/src
parentbc14b2cd549a482f648d983b3db10e6125179239 (diff)
downloadeclipse.jdt.core-a99fc26ff94745bbcda6366c6cba02d85aeb2315.tar.gz
eclipse.jdt.core-a99fc26ff94745bbcda6366c6cba02d85aeb2315.tar.xz
eclipse.jdt.core-a99fc26ff94745bbcda6366c6cba02d85aeb2315.zip
Bug 544224 - [12] Switch Expression - Unexpected compiler error for
parenthesized expression
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java
index cfabad7ae0..eeb24b70ce 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java
@@ -1810,4 +1810,27 @@ public class SwitchExpressionTest extends AbstractRegressionTest {
customOptions,
new String[] {"--enable-preview"});
}
+ public void testBug544224_1() {
+ Map<String, String> customOptions = getCompilerOptions();
+ customOptions.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public int foo(int i) {\n" +
+ " int j = (switch (i) {\n" +
+ " case 1 -> 1;\n" +
+ " default -> 2;\n" +
+ " });\n" +
+ " return j;\n" +
+ " }\n" +
+ " public static void main(String[] argv) {\n" +
+ " new X().foo(1);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "",
+ customOptions,
+ new String[] {"--enable-preview"});
+ }
} \ No newline at end of file

Back to the top