From ccaefff69fc021048ac6918948a0cae29e045b76 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Wed, 24 Apr 2019 13:52:17 +0200 Subject: [jdk12] adding support for the new nodes introduced for the improvements to switch statements, and the ‘switch expression’ preview feature, as well as support for the concept of preview features in general. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/pretty/resource/after/Switch11.java | 11 +++++++++++ test/pretty/resource/after/Switch12.java | 28 ++++++++++++++++++++++++++++ test/pretty/resource/before/Switch11.java | 12 ++++++++++++ test/pretty/resource/before/Switch12.java | 30 ++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 test/pretty/resource/after/Switch11.java create mode 100644 test/pretty/resource/after/Switch12.java create mode 100644 test/pretty/resource/before/Switch11.java create mode 100644 test/pretty/resource/before/Switch12.java (limited to 'test/pretty/resource') diff --git a/test/pretty/resource/after/Switch11.java b/test/pretty/resource/after/Switch11.java new file mode 100644 index 00000000..d24012a2 --- /dev/null +++ b/test/pretty/resource/after/Switch11.java @@ -0,0 +1,11 @@ +public class Switch11 { + public void basic() { + switch (5) { + case 1: + case 2: + System.out.println("OK"); + break; + default: + } + } +} diff --git a/test/pretty/resource/after/Switch12.java b/test/pretty/resource/after/Switch12.java new file mode 100644 index 00000000..89825223 --- /dev/null +++ b/test/pretty/resource/after/Switch12.java @@ -0,0 +1,28 @@ +public class Switch12 { + public void basic() { + switch (5) { + case 1: + case 2: + System.out.println("OK"); + break; + default: + } + } + public void multiCase() { + switch (5) { + case 1, 2: + System.out.println("OK"); + default: + } + } + + public int switchExpr() { + return switch (5) { + case 1, 2 -> 0; + case 3 -> { + break 10; + } + default -> 10; + } + 10; + } +} diff --git a/test/pretty/resource/before/Switch11.java b/test/pretty/resource/before/Switch11.java new file mode 100644 index 00000000..556631f0 --- /dev/null +++ b/test/pretty/resource/before/Switch11.java @@ -0,0 +1,12 @@ +// version :11 +public class Switch11 { + public void basic() { + switch (5) { + case 1: + case 2: + System.out.println("OK"); + break; + default: + } + } +} diff --git a/test/pretty/resource/before/Switch12.java b/test/pretty/resource/before/Switch12.java new file mode 100644 index 00000000..f1bd8a79 --- /dev/null +++ b/test/pretty/resource/before/Switch12.java @@ -0,0 +1,30 @@ +// version 12: +public class Switch12 { + public void basic() { + switch (5) { + case 1: + case 2: + System.out.println("OK"); + break; + default: + } + } + + public void multiCase() { + switch (5) { + case 1, 2: + System.out.println("OK"); + default: + } + } + + public int switchExpr() { + return switch (5) { + case 1, 2 -> 0; + case 3 -> { + break 10; + } + default -> 10; + } + 10; + } +} -- cgit From 532c28ea62bcf6e1be4e45fd0a4694dfe7c1b75d Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Wed, 24 Apr 2019 13:53:14 +0200 Subject: [trivial] fatfingered a test file name somehow. --- test/pretty/resource/after/Java11Var.java | 6 ++++++ test/pretty/resource/after/Java11Var.javva | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 test/pretty/resource/after/Java11Var.java delete mode 100644 test/pretty/resource/after/Java11Var.javva (limited to 'test/pretty/resource') diff --git a/test/pretty/resource/after/Java11Var.java b/test/pretty/resource/after/Java11Var.java new file mode 100644 index 00000000..cec4be6d --- /dev/null +++ b/test/pretty/resource/after/Java11Var.java @@ -0,0 +1,6 @@ +public class Java11Var { + public void test() { + var b = 10; + int c = 11; + } +} diff --git a/test/pretty/resource/after/Java11Var.javva b/test/pretty/resource/after/Java11Var.javva deleted file mode 100644 index cec4be6d..00000000 --- a/test/pretty/resource/after/Java11Var.javva +++ /dev/null @@ -1,6 +0,0 @@ -public class Java11Var { - public void test() { - var b = 10; - int c = 11; - } -} -- cgit