aboutsummaryrefslogtreecommitdiff
path: root/src/delombok
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2022-08-26 00:53:47 +0200
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2023-01-12 00:37:54 +0100
commitad35c80843c88e8717f62770a8b0531de8615947 (patch)
tree6de7ed3894a6c448523923d72c89707708dcb1dd /src/delombok
parent7928cf4ba05e3b9e858be655dc43e60f0335dacd (diff)
downloadlombok-ad35c80843c88e8717f62770a8b0531de8615947.tar.gz
lombok-ad35c80843c88e8717f62770a8b0531de8615947.tar.bz2
lombok-ad35c80843c88e8717f62770a8b0531de8615947.zip
[jdk19] Add support for record pattern
Diffstat (limited to 'src/delombok')
-rw-r--r--src/delombok/lombok/delombok/PrettyPrinter.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java
index ee1380f6..13836d77 100644
--- a/src/delombok/lombok/delombok/PrettyPrinter.java
+++ b/src/delombok/lombok/delombok/PrettyPrinter.java
@@ -1461,6 +1461,18 @@ public class PrettyPrinter extends JCTree.Visitor {
}
}
+ void printRecordPattern(JCTree tree) {
+ print((JCTree) readObject(tree, "deconstructor", null));
+ print("(");
+ print(readObject(tree, "nested", List.<JCTree>nil()), ", ");
+ print(")");
+ JCVariableDecl var = readObject(tree, "var", null);
+ if (var != null) {
+ print(" ");
+ print(var.name);
+ }
+ }
+
@Override public void visitTry(JCTry tree) {
aPrint("try ");
List<?> resources = readObject(tree, "resources", List.nil());
@@ -1689,6 +1701,8 @@ public class PrettyPrinter extends JCTree.Visitor {
printConstantCaseLabel(tree);
} else if (className.endsWith("$JCPatternCaseLabel")) { // Introduced in JDK19
printPatternCaseLabel(tree);
+ } else if (className.endsWith("$JCRecordPattern")) { // Introduced in JDK19
+ printRecordPattern(tree);
} else {
throw new AssertionError("Unhandled tree type: " + tree.getClass() + ": " + tree);
}