Package org.checkerframework.javacutil
Class TreeUtilsAfterJava11.CaseUtils
java.lang.Object
org.checkerframework.javacutil.TreeUtilsAfterJava11.CaseUtils
- Enclosing class:
TreeUtilsAfterJava11
@Deprecated(forRemoval=true,
since="4.0.0")
public static class TreeUtilsAfterJava11.CaseUtils
extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
Utility methods for accessing
CaseTree methods.-
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.static List<? extends ExpressionTree> getExpressions(CaseTree caseTree) Deprecated, for removal: This API element is subject to removal in a future version.static @Nullable ExpressionTreeDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.static booleanisCaseRule(CaseTree caseTree) Deprecated, for removal: This API element is subject to removal in a future version.static booleanisDefaultCaseLabelTree(Tree tree) Deprecated, for removal: This API element is subject to removal in a future version.static booleanisDefaultCaseTree(CaseTree caseTree) Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Details
-
isCaseRule
Deprecated, for removal: This API element is subject to removal in a future version.Returns true if this is a case rule (as opposed to a case statement).- Parameters:
caseTree- a case tree- Returns:
- true if
caseTreeis a case rule
-
getBody
Deprecated, for removal: This API element is subject to removal in a future version.Returns the body of the case statement if it is of the formcase <expression> -> <expression>. This method should only be called ifCaseTree.getStatements()returns null.- Parameters:
caseTree- the case expression to get the body from- Returns:
- the body of the case tree
-
isDefaultCaseTree
@Deprecated(forRemoval=true, since="4.0.0") public static boolean isDefaultCaseTree(CaseTree caseTree) Deprecated, for removal: This API element is subject to removal in a future version.Returns true if this is the default case for a switch statement or expression. (Also, returns true ifcaseTreeiscase null, default:.)- Parameters:
caseTree- a case tree- Returns:
- true if
caseTreeis the default case for a switch statement or expression
-
isDefaultCaseLabelTree
Deprecated, for removal: This API element is subject to removal in a future version.Returns true iftreeis aDefaultCaseLabelTree.- Parameters:
tree- a tree to check- Returns:
- true if
treeis aDefaultCaseLabelTree
-
getLabels
@Deprecated(forRemoval=true, since="4.0.0") public static List<? extends Tree> getLabels(CaseTree caseTree) Deprecated, for removal: This API element is subject to removal in a future version.Returns the list of labels from a case expression. Fordefault, this is empty. Forcase null, default, the list containsnull. Otherwise, in JDK 11 and earlier, this is a list of a single expression tree. In JDK 12+, the list may have multiple expression trees. In JDK 21+, the list might contain a single pattern tree.- Parameters:
caseTree- the case expression to get the labels from- Returns:
- the list of case labels in the case
-
getExpressions
@Deprecated(forRemoval=true, since="4.0.0") public static List<? extends ExpressionTree> getExpressions(CaseTree caseTree) Deprecated, for removal: This API element is subject to removal in a future version.Returns the list of expressions from a case expression. For the default case, this is empty. Otherwise, in JDK 11 and earlier, this is a singleton list. In JDK 12 onwards, there can be multiple expressions per case.- Parameters:
caseTree- the case expression to get the expressions from- Returns:
- the list of expressions in the case
-
getGuard
@Deprecated(forRemoval=true, since="4.0.0") public static @Nullable ExpressionTree getGuard(CaseTree caseTree) Deprecated, for removal: This API element is subject to removal in a future version.Returns the guard, the expression afterwhen, ofcaseTree. Wrapper aroundCaseTree#getGuardthat can be called on any version of Java.- Parameters:
caseTree- the case tree- Returns:
- the guard on the case tree or null if one does not exist
-
CaseTree.getBody()