Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thomann2019-02-19 23:29:00 +0000
committerManoj Palat2019-02-19 23:29:00 +0000
commit59864f9cede1831499e07da1840edc72e84d9a0e (patch)
tree4ee032949bec11c7d8a5cfaaa809f667935b4e0f /org.eclipse.jdt.core.tests.compiler/src
parent02c1e55fb872aa51702ec2828e96c5d6278119cf (diff)
downloadeclipse.jdt.core-59864f9cede1831499e07da1840edc72e84d9a0e.tar.gz
eclipse.jdt.core-59864f9cede1831499e07da1840edc72e84d9a0e.tar.xz
eclipse.jdt.core-59864f9cede1831499e07da1840edc72e84d9a0e.zip
Bug 544458 - [12][codegen] Switch Expressions - Inconsistent stackmapY20190220-2200
frames
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.java105
1 files changed, 105 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 024a09027e..0e09b494d6 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
@@ -1968,4 +1968,109 @@ public class SwitchExpressionTest extends AbstractRegressionTest {
null,
new String[] {"--enable-preview"});
}
+ public void testBug544458() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static int foo(int i) {\n" +
+ " boolean v = switch (i) {\n" +
+ " case 1: i = 10; break true;\n" +
+ " default: break false;\n" +
+ " };\n" +
+ " return v ? 0 : 1;\n" +
+ " }\n" +
+ " public static void main(String[] argv) {\n" +
+ " System.out.println(X.foo(0));\n" +
+ " }\n" +
+ "}"
+ },
+ "1",
+ null,
+ new String[] {"--enable-preview"});
+ }
+ public void testBug544458_2() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static int foo(int i) {\n" +
+ " boolean v = switch (i) {\n" +
+ " case 1: i++; break true;\n" +
+ " default: break false;\n" +
+ " };\n" +
+ " return v ? 0 : 1;\n" +
+ " }\n" +
+ " public static void main(String[] argv) {\n" +
+ " System.out.println(X.foo(1));\n" +
+ " }\n" +
+ "}"
+ },
+ "0",
+ null,
+ new String[] {"--enable-preview"});
+ }
+ public void testBug544458_3() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static int foo(int i) {\n" +
+ " boolean v = switch (i) {\n" +
+ " case 1: i+= 10; break true;\n" +
+ " default: break false;\n" +
+ " };\n" +
+ " return v ? 0 : 1;\n" +
+ " }\n" +
+ " public static void main(String[] argv) {\n" +
+ " System.out.println(X.foo(1));\n" +
+ " }\n" +
+ "}"
+ },
+ "0",
+ null,
+ new String[] {"--enable-preview"});
+ }
+ public void testBug544458_4() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static int foo(int i) {\n" +
+ " boolean v = switch (i) {\n" +
+ " case 1: switch(i) {case 4: break;}; break true;\n" +
+ " default: break false;\n" +
+ " };\n" +
+ " return v ? 0 : 1;\n" +
+ " }\n" +
+ " public static void main(String[] argv) {\n" +
+ " System.out.println(X.foo(1));\n" +
+ " }\n" +
+ "}"
+ },
+ "0",
+ null,
+ new String[] {"--enable-preview"});
+ }
+ public void testBug544458_5() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static int foo(int i) {\n" +
+ " boolean v = switch (i) {\n" +
+ " case 1: foo(5); break true;\n" +
+ " default: break false;\n" +
+ " };\n" +
+ " return v ? 0 : 1;\n" +
+ " }\n" +
+ " public static void main(String[] argv) {\n" +
+ " System.out.println(X.foo(1));\n" +
+ " }\n" +
+ "}"
+ },
+ "0",
+ null,
+ new String[] {"--enable-preview"});
+ }
} \ No newline at end of file

Back to the top