aboutsummaryrefslogtreecommitdiff
path: root/test/pretty/resource/after
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2023-01-11 22:54:04 +0100
committerGitHub <noreply@github.com>2023-01-11 22:54:04 +0100
commit9388dbc1a990386dd7b3af6ac65e123f7cd89013 (patch)
tree32013941432178d435da9b1ae07ac6b1faa10927 /test/pretty/resource/after
parent3705ac615a34191e3f05bf02329a9ffe09d5fa65 (diff)
parent479bd2d75d2046ee1cb337ef6aa929b707868345 (diff)
downloadlombok-9388dbc1a990386dd7b3af6ac65e123f7cd89013.tar.gz
lombok-9388dbc1a990386dd7b3af6ac65e123f7cd89013.tar.bz2
lombok-9388dbc1a990386dd7b3af6ac65e123f7cd89013.zip
Merge pull request #3251 from Rawi01/jdk19
Add support for JDK 19
Diffstat (limited to 'test/pretty/resource/after')
-rw-r--r--test/pretty/resource/after/RecordPattern.java15
-rw-r--r--test/pretty/resource/after/Switch19.java32
2 files changed, 47 insertions, 0 deletions
diff --git a/test/pretty/resource/after/RecordPattern.java b/test/pretty/resource/after/RecordPattern.java
new file mode 100644
index 00000000..ad9fae0b
--- /dev/null
+++ b/test/pretty/resource/after/RecordPattern.java
@@ -0,0 +1,15 @@
+record Point(int x, int y) {
+}
+record Rectangle(Point upperLeft, Point lowerRight) {
+}
+
+public class RecordPattern {
+ void recordPattern(Object o) {
+ if (o instanceof Point(int x, int y)) {
+ }
+ if (o instanceof Point(int x, int y) p) {
+ }
+ if (o instanceof Rectangle(Point(int x1, int y1), Point(int x2, int y2))) {
+ }
+ }
+} \ No newline at end of file
diff --git a/test/pretty/resource/after/Switch19.java b/test/pretty/resource/after/Switch19.java
new file mode 100644
index 00000000..5947830b
--- /dev/null
+++ b/test/pretty/resource/after/Switch19.java
@@ -0,0 +1,32 @@
+public class Switch19 {
+ 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 when s.length() > 1 -> s;
+ case String s -> s;
+ default -> o.toString();
+ };
+ }
+
+ String switchParenthesizedPattern(Object o) {
+ return switch (o) {
+ case (String s) -> s;
+ default -> o.toString();
+ };
+ }
+}