aboutsummaryrefslogtreecommitdiff
path: root/test/pretty/resource/after
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2021-08-18 09:37:21 +0200
committerRawi01 <Rawi01@users.noreply.github.com>2021-08-18 09:37:21 +0200
commitdf2601f9dba97ab1a10e7f6be5222968f3335150 (patch)
treec7c16d3752b7db6fcebb10b0a2a33feee21d1a0b /test/pretty/resource/after
parent91859536db8cf4b59235c01474621f81641f9032 (diff)
downloadlombok-df2601f9dba97ab1a10e7f6be5222968f3335150.tar.gz
lombok-df2601f9dba97ab1a10e7f6be5222968f3335150.tar.bz2
lombok-df2601f9dba97ab1a10e7f6be5222968f3335150.zip
[jdk17] Add support for guard/parenthesized pattern
Diffstat (limited to 'test/pretty/resource/after')
-rw-r--r--test/pretty/resource/after/Switch17.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/pretty/resource/after/Switch17.java b/test/pretty/resource/after/Switch17.java
new file mode 100644
index 00000000..038f2cd9
--- /dev/null
+++ b/test/pretty/resource/after/Switch17.java
@@ -0,0 +1,31 @@
+public class Switch17 {
+ String switchPatternMatching(Object o) {
+ return switch (o) {
+ case Integer i -> String.format("int %d", i);
+ case Long l -> String.format("long %d", l);
+ case Double d -> String.format("double %f", d);
+ case String s -> String.format("String %s", s);
+ default -> o.toString();
+ };
+ }
+
+ String switchNull(Object o) {
+ return switch (o) {
+ case null, default -> "?";
+ };
+ }
+
+ String switchGuardPattern(Object o) {
+ return switch (o) {
+ case String s && s.length() > 1 -> s;
+ default -> o.toString();
+ };
+ }
+
+ String switchParenthesizedPattern(Object o) {
+ return switch (o) {
+ case (String s) -> s;
+ default -> o.toString();
+ };
+ }
+} \ No newline at end of file