From fedc92663e563079c3b6a09c58ab3f73372000fe Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Fri, 26 Aug 2022 00:49:42 +0200 Subject: [jdk19] Add support for JCConstantCaseLabel --- src/utils/lombok/javac/JavacTreeMaker.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/utils/lombok') diff --git a/src/utils/lombok/javac/JavacTreeMaker.java b/src/utils/lombok/javac/JavacTreeMaker.java index d369b4e4..09855951 100644 --- a/src/utils/lombok/javac/JavacTreeMaker.java +++ b/src/utils/lombok/javac/JavacTreeMaker.java @@ -610,6 +610,8 @@ public class JavacTreeMaker { List labels; if (pat == null) { labels = tryResolve(DefaultCaseLabel) ? List.of(DefaultCaseLabel()) : List.nil(); + } else if (tryResolve(ConstantCaseLabel)) { + labels = List.of(ConstantCaseLabel(pat)); } else { labels = List.of(pat); } @@ -622,6 +624,12 @@ public class JavacTreeMaker { return invoke(DefaultCaseLabel); } + //javac versions: 19 + private static final MethodId ConstantCaseLabel = MethodId("ConstantCaseLabel", JCTree.class, JCExpression.class); + public JCTree ConstantCaseLabel(JCExpression expr) { + return invoke(ConstantCaseLabel, expr); + } + //javac versions: 6-8 private static final MethodId Synchronized = MethodId("Synchronized"); public JCSynchronized Synchronized(JCExpression lock, JCBlock body) { -- cgit