aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2022-08-26 00:53:21 +0200
committerRawi01 <Rawi01@users.noreply.github.com>2022-08-26 00:53:21 +0200
commit957adfae2ece1fe8a469976143ae7c8db8e67686 (patch)
treef3afb5c9a4a3f221788b552f090f55decc616887 /src
parent646723f6d30404b2974af4fbefad5d8843460fea (diff)
downloadlombok-957adfae2ece1fe8a469976143ae7c8db8e67686.tar.gz
lombok-957adfae2ece1fe8a469976143ae7c8db8e67686.tar.bz2
lombok-957adfae2ece1fe8a469976143ae7c8db8e67686.zip
[jdk19] Add support for new guard pattern
Diffstat (limited to 'src')
-rw-r--r--src/delombok/lombok/delombok/PrettyPrinter.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java
index 8e7bc7e5..ee1380f6 100644
--- a/src/delombok/lombok/delombok/PrettyPrinter.java
+++ b/src/delombok/lombok/delombok/PrettyPrinter.java
@@ -1452,6 +1452,15 @@ public class PrettyPrinter extends JCTree.Visitor {
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);
+ }
+ }
+
@Override public void visitTry(JCTry tree) {
aPrint("try ");
List<?> resources = readObject(tree, "resources", List.nil());
@@ -1678,6 +1687,8 @@ public class PrettyPrinter extends JCTree.Visitor {
printParenthesizedPattern(tree);
} else if (className.endsWith("$JCConstantCaseLabel")) { // Introduced in JDK19
printConstantCaseLabel(tree);
+ } else if (className.endsWith("$JCPatternCaseLabel")) { // Introduced in JDK19
+ printPatternCaseLabel(tree);
} else {
throw new AssertionError("Unhandled tree type: " + tree.getClass() + ": " + tree);
}