Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thomann2019-02-11 23:29:59 +0000
committerManoj Palat2019-02-12 01:52:25 +0000
commitdd1ad840550c0405543b14b09d21f3c532e89227 (patch)
tree07638a9e73e90fcece61d72864ce54593d666777 /org.eclipse.jdt.core.tests.compiler/src
parent38aa04c36dd56e5b4177f0ccc5530d29f59a7341 (diff)
downloadeclipse.jdt.core-dd1ad840550c0405543b14b09d21f3c532e89227.tar.gz
eclipse.jdt.core-dd1ad840550c0405543b14b09d21f3c532e89227.tar.xz
eclipse.jdt.core-dd1ad840550c0405543b14b09d21f3c532e89227.zip
Bug 544298 [12][codegen] Switch Expressions - exceeded stack size
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.java51
1 files changed, 51 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 37e8abfa02..e3d78a2c57 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
@@ -1834,4 +1834,55 @@ public class SwitchExpressionTest extends AbstractRegressionTest {
customOptions,
new String[] {"--enable-preview"});
}
+ public void testBug544298() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " enum MyEnum {\n" +
+ " FIRST;\n" +
+ " }\n" +
+ "\n" +
+ " public void foo(MyEnum myEnum) {\n" +
+ " int i = switch (myEnum) {\n" +
+ " case FIRST -> 1;\n" +
+ " };\n" +
+ " System.out.println( \"i:\" + i);\n" +
+ " }\n" +
+ "\n" +
+ " public static void main(String argv[]) {\n" +
+ " new X().foo(MyEnum.FIRST);\n" +
+ " }\n" +
+ "}"
+ },
+ "i:1",
+ null,
+ new String[] {"--enable-preview"});
+ }
+ public void testBug544298_2() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " enum MyEnum {\n" +
+ " FIRST;\n" +
+ " }\n" +
+ "\n" +
+ " public void foo(MyEnum myEnum) {\n" +
+ " int i = switch (myEnum) {\n" +
+ " case FIRST -> 1;\n" +
+ " default -> 0;\n" +
+ " };\n" +
+ " System.out.println( \"i:\" + i);\n" +
+ " }\n" +
+ "\n" +
+ " public static void main(String argv[]) {\n" +
+ " new X().foo(MyEnum.FIRST);\n" +
+ " }\n" +
+ "}"
+ },
+ "i:1",
+ null,
+ new String[] {"--enable-preview"});
+ }
} \ No newline at end of file

Back to the top