Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManoj Palat2019-02-20 09:59:48 +0000
committerManoj Palat2019-02-22 00:33:36 +0000
commitce88cb13b15fbd28376cd9f9cc3207043563910e (patch)
tree3ba7c0019f368bd65ed9598412e1fe5c0ff80de1 /org.eclipse.jdt.core.tests.compiler/src
parent59bc9a313e66cbc68bf9742a76f5eecef150bdc4 (diff)
downloadeclipse.jdt.core-ce88cb13b15fbd28376cd9f9cc3207043563910e.tar.gz
eclipse.jdt.core-ce88cb13b15fbd28376cd9f9cc3207043563910e.tar.xz
eclipse.jdt.core-ce88cb13b15fbd28376cd9f9cc3207043563910e.zip
Bug 544601 - [12] npe with a switch statement in switch 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.java31
1 files changed, 31 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 0e09b494d6..29bc46acfa 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
@@ -2073,4 +2073,35 @@ public class SwitchExpressionTest extends AbstractRegressionTest {
null,
new String[] {"--enable-preview"});
}
+ public void testBug544601_1() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public int foo(int i) {\n" +
+ " @SuppressWarnings(\"preview\")\n" +
+ " boolean v = switch (i) {\n" +
+ " case 1:\n" +
+ " switch (i) {\n" +
+ " case 1 : i = 10;\n" +
+ " break;\n" +
+ " default :\n" +
+ " i = 2;\n" +
+ " break;\n" +
+ " }\n" +
+ " break true;\n" +
+ " default: break false;\n" +
+ " };\n" +
+ " return v ? 0 : 1;\n" +
+ " }\n" +
+ "\n" +
+ " public static void main(String[] argv) {\n" +
+ " System.out.println(new X().foo(0));\n" +
+ " }\n" +
+ "}\n"
+ },
+ "1",
+ null,
+ new String[] {"--enable-preview"});
+ }
} \ No newline at end of file

Back to the top