Class ASTSwitchLabel

java.lang.Object
net.sourceforge.pmd.lang.ast.impl.AbstractNode<B,N>
net.sourceforge.pmd.lang.ast.impl.javacc.AbstractJjtreeNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode>
net.sourceforge.pmd.lang.java.ast.ASTSwitchLabel
All Implemented Interfaces:
Iterable<ASTExpression>, GenericNode<JavaNode>, JjtreeNode<JavaNode>, Node, TextAvailableNode, JavaNode, Reportable

public final class ASTSwitchLabel extends AbstractJjtreeNode<net.sourceforge.pmd.lang.java.ast.AbstractJavaNode,JavaNode> implements Iterable<ASTExpression>
Represents either a case or default label inside a switch statement or expression. Since Java 14, labels may have several expressions.

 SwitchLabel ::=  "case" Expression ("," Expression )*
                | "case" "null [ "," "default" ]
                | "case" ( TypePattern | RecordPattern )
                | "default"

 

Note: case null and the case patterns are a Java 21 language feature

See Also: