diff options
author | Rawi01 <Rawi01@users.noreply.github.com> | 2023-02-18 23:04:51 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2023-03-21 16:12:22 +0100 |
commit | 83c4dcfd5257975e9582be017bf66a7232cc2cbb (patch) | |
tree | 69b6d689b20d11ebb7f7cebeb05084a248a64046 /test/pretty | |
parent | e5c324c615c1e304b2a9a64bc7f8608a67b0a74e (diff) | |
download | lombok-83c4dcfd5257975e9582be017bf66a7232cc2cbb.tar.gz lombok-83c4dcfd5257975e9582be017bf66a7232cc2cbb.tar.bz2 lombok-83c4dcfd5257975e9582be017bf66a7232cc2cbb.zip |
[jdk20] Updates support for record patterns
Diffstat (limited to 'test/pretty')
-rw-r--r-- | test/pretty/resource/after/RecordPattern19.java (renamed from test/pretty/resource/after/RecordPattern.java) | 4 | ||||
-rw-r--r-- | test/pretty/resource/after/RecordPattern20.java | 22 | ||||
-rw-r--r-- | test/pretty/resource/before/RecordPattern19.java (renamed from test/pretty/resource/before/RecordPattern.java) | 6 | ||||
-rw-r--r-- | test/pretty/resource/before/RecordPattern20.java | 23 |
4 files changed, 50 insertions, 5 deletions
diff --git a/test/pretty/resource/after/RecordPattern.java b/test/pretty/resource/after/RecordPattern19.java index ad9fae0b..68b39266 100644 --- a/test/pretty/resource/after/RecordPattern.java +++ b/test/pretty/resource/after/RecordPattern19.java @@ -3,13 +3,13 @@ record Point(int x, int y) { record Rectangle(Point upperLeft, Point lowerRight) { } -public class RecordPattern { +public class RecordPattern19 { 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))) { + if (o instanceof Rectangle(Point(var x1, var y1), Point(int x2, int y2))) { } } }
\ No newline at end of file diff --git a/test/pretty/resource/after/RecordPattern20.java b/test/pretty/resource/after/RecordPattern20.java new file mode 100644 index 00000000..365b139f --- /dev/null +++ b/test/pretty/resource/after/RecordPattern20.java @@ -0,0 +1,22 @@ +record Point(int x, int y) { +} +record Rectangle(Point upperLeft, Point lowerRight) { +} + +public class RecordPattern20 { + void recordPattern(Object o) { + if (o instanceof Point(int x, int y)) { + } + if (o instanceof Rectangle(Point(var x1, var y1), Point(int x2, int y2))) { + } + } + + void forEachSimple(Point[] pointArray) { + for (Point(var x, var y) : pointArray) { + } + } + void forEachNested(Rectangle[] rectangleArray) { + for (Rectangle(Point(var x1, var y1), Point p) : rectangleArray) { + } + } +}
\ No newline at end of file diff --git a/test/pretty/resource/before/RecordPattern.java b/test/pretty/resource/before/RecordPattern19.java index 93c07965..4c417174 100644 --- a/test/pretty/resource/before/RecordPattern.java +++ b/test/pretty/resource/before/RecordPattern19.java @@ -1,16 +1,16 @@ -// version 19: +// version 19:19 record Point(int x, int y) { } record Rectangle(Point upperLeft, Point lowerRight) { } -public class RecordPattern { +public class RecordPattern19 { 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))) { + if (o instanceof Rectangle(Point(var x1, var y1), Point(int x2, int y2))) { } } }
\ No newline at end of file diff --git a/test/pretty/resource/before/RecordPattern20.java b/test/pretty/resource/before/RecordPattern20.java new file mode 100644 index 00000000..8604215b --- /dev/null +++ b/test/pretty/resource/before/RecordPattern20.java @@ -0,0 +1,23 @@ +// version 20: +record Point(int x, int y) { +} +record Rectangle(Point upperLeft, Point lowerRight) { +} + +public class RecordPattern20 { + void recordPattern(Object o) { + if (o instanceof Point(int x, int y)) { + } + if (o instanceof Rectangle(Point(var x1, var y1), Point(int x2, int y2))) { + } + } + + void forEachSimple(Point[] pointArray) { + for (Point(var x, var y) : pointArray) { + } + } + void forEachNested(Rectangle[] rectangleArray) { + for (Rectangle(Point(var x1, var y1), Point p) : rectangleArray) { + } + } +}
\ No newline at end of file |