aboutsummaryrefslogtreecommitdiff
path: root/src/delombok/lombok
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 /src/delombok/lombok
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 'src/delombok/lombok')
-rw-r--r--src/delombok/lombok/delombok/PrettyPrinter.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java
index 605b9391..13836d77 100644
--- a/src/delombok/lombok/delombok/PrettyPrinter.java
+++ b/src/delombok/lombok/delombok/PrettyPrinter.java
@@ -1448,6 +1448,31 @@ public class PrettyPrinter extends JCTree.Visitor {
print(")");
}
+ void printConstantCaseLabel(JCTree tree) {
+ print((JCTree) readObject(tree, "expr", null));
+ }
+
+ void printPatternCaseLabel(JCTree tree) {
+ print((JCTree) readObject(tree, "pat", null));
+ JCTree guard = readObject(tree, "guard", null);
+ if (guard != null) {
+ print(" when ");
+ print(guard);
+ }
+ }
+
+ 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());
@@ -1672,6 +1697,12 @@ public class PrettyPrinter extends JCTree.Visitor {
printGuardPattern(tree);
} else if (className.endsWith("$JCParenthesizedPattern")) { // Introduced in JDK17
printParenthesizedPattern(tree);
+ } else if (className.endsWith("$JCConstantCaseLabel")) { // Introduced in JDK19
+ 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);
}