From 18058d532000141d136bb03cafb073e8173ba8c8 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Tue, 26 Sep 2023 08:52:03 -0700 Subject: [PATCH] Automatic code cleanup. PiperOrigin-RevId: 568553066 --- .../PlaceholderUnificationVisitor.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/src/main/java/com/google/errorprone/refaster/PlaceholderUnificationVisitor.java b/core/src/main/java/com/google/errorprone/refaster/PlaceholderUnificationVisitor.java index c3e08db3bbbd..dea7fcc574f2 100644 --- a/core/src/main/java/com/google/errorprone/refaster/PlaceholderUnificationVisitor.java +++ b/core/src/main/java/com/google/errorprone/refaster/PlaceholderUnificationVisitor.java @@ -674,6 +674,24 @@ private JCCase makeCase(CaseTree node, List stmts) { checkState( caseKind.name().contentEquals("STATEMENT"), "expression switches are not supported yet"); + if (RuntimeVersion.isAtLeast21()) { + return (JCCase) + TreeMaker.class + .getMethod( + "Case", + Class.forName("com.sun.source.tree.CaseTree$CaseKind"), + List.class, + JCExpression.class, + List.class, + JCTree.class) + .invoke( + maker(), + caseKind, + CaseTree.class.getMethod("getLabels").invoke(node), + CaseTree.class.getMethod("getGuard").invoke(node), + stmts, + /* body */ null); + } return (JCCase) TreeMaker.class .getMethod(