From 479bd2d75d2046ee1cb337ef6aa929b707868345 Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Fri, 26 Aug 2022 00:53:47 +0200 Subject: [jdk19] Add support for record pattern --- src/delombok/lombok/delombok/PrettyPrinter.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/delombok/lombok') 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.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); } -- cgit