Package net.sourceforge.pmd.lang.java.ast
Contains the classes and interfaces modelling the Java AST.
Note: from 6.16.0 on, the following usages have been deprecated:
- Manual instantiation of nodes. Constructors of node classes are
deprecated and marked
InternalApi
. Nodes should only be obtained from the parser, which for rules, means that never need to instantiate node themselves. Those constructors will be made package private with 7.0.0. - Subclassing of base node classes, or usage of their type.
Version 7.0.0 will bring a new set of abstractions that will
be public API, but the base classes are and will stay internal.
You should not couple your code to them.
In the meantime you should use interfaces like
JavaNode
orNode
, or the other published interfaces in this package, to refer to nodes generically. - Setters found in any node class or interface. Rules should consider the AST immutable. We will make those setters package private with 7.0.0.
-
Interface Summary Interface Description AccessNode This interface captures Java access modifiers.Annotatable The interface use to mark nodes that can be annotated.ASTAnyTypeBodyDeclaration Marker interface for type body declarations, such as annotation members, field or method declarations.ASTAnyTypeDeclaration Groups class, enum, record, annotation and interface declarations.ASTMethodOrConstructorDeclaration Groups method and constructor declarations under a common type.ASTPattern A pattern (for pattern matching constructs likeInstanceOfExpression
).ASTSwitchLabeledRule CanSuppressWarnings Deprecated. This interface will be removed, the AST should not know about rules.Dimensionable Deprecated. Will be removed with 7.0.0.JavaNode Root interface for all Nodes of the Java AST.JavaParserConstants Deprecated. JavaParserControllessVisitor Deprecated. Visitor decorators are deprecated because they lead to fragile code.JavaParserTreeConstants Deprecated. JavaParserVisitor JavaQualifiableNode Deprecated. MethodLikeNode Deprecated. Lambda expressions should not be grouped with other kinds of method declarations, they have nothing in common.TypeNode This interface allows a Java Class to be associated with a node. -
Class Summary Class Description AbstractAnyTypeDeclaration Deprecated. AbstractJavaAccessNode Deprecated. AbstractJavaAccessTypeNode Deprecated. AbstractJavaNode Deprecated. AbstractJavaTypeNode Deprecated. AbstractMethodLikeNode Deprecated. AbstractMethodOrConstructorDeclaration Deprecated. ASTAdditiveExpression Represents an addition operation on two or more values, or string concatenation.ASTAllocationExpression ASTAndExpression Represents a non-shortcut boolean AND-expression.ASTAnnotation Represents an annotation.ASTAnnotationMethodDeclaration ASTAnnotationTypeBody ASTAnnotationTypeDeclaration ASTAnnotationTypeMemberDeclaration ASTArgumentList ASTArguments ASTArrayDimsAndInits ASTArrayInitializer ASTAssertStatement Represents anassert
statement.ASTAssignmentOperator Represents an assignment operator in an assignment expression.ASTBlock ASTBlockStatement ASTBooleanLiteral ASTBreakStatement ASTCastExpression ASTCatchStatement Catch statement node.ASTClassOrInterfaceBody Represents the body of a class or interface declaration.ASTClassOrInterfaceBodyDeclaration ASTClassOrInterfaceDeclaration Represents class and interface declarations.ASTClassOrInterfaceType Represents a class or interface type, possibly parameterised with type arguments.ASTCompilationUnit ASTConditionalAndExpression Represents a boolean AND-expression.ASTConditionalExpression Represents a conditional expression, aka ternary expression.ASTConditionalOrExpression Represents a boolean OR-expression.ASTConstructorDeclaration ASTContinueStatement ASTDefaultValue ASTDoStatement Represents ado ... while
statement.ASTEmptyStatement ASTEnumBody ASTEnumConstant Represents an enum constant declaration within an enum declaration.ASTEnumDeclaration ASTEqualityExpression Represents an identity test between two values or more values.ASTExclusiveOrExpression Represents a boolean XOR-expression.ASTExplicitConstructorInvocation ASTExpression Represents an expression, in the most general sense.ASTExtendsList Represents theextends
clause of a class or interface declaration.ASTFieldDeclaration Represents a field declaration in the body of a type declaration.ASTFinallyStatement ASTForInit ASTFormalParameter Formal parameter node.ASTFormalParameters ASTForStatement Represents afor
-loop, or a foreach loop.ASTForUpdate Update clause of a for statement.ASTIfStatement Represents anif
statement, possibly with anelse
statement.ASTImplementsList Represents theimplements
clause of a class declaration.ASTImportDeclaration Represents an import declaration in a Java file.ASTInclusiveOrExpression Represents a non-shortcut boolean OR-expression.ASTInitializer ASTInstanceOfExpression Represents a type test on an object.ASTLabeledStatement ASTLambdaExpression ASTLiteral ASTLocalVariableDeclaration Represents a local variable declaration.ASTMarkerAnnotation Represents an annotation with no declared member, e.g.ASTMemberSelector ASTMemberValue Represents the value of a member of an annotation.ASTMemberValueArrayInitializer Represents an array of member values in an annotation member value.ASTMemberValuePair Represents a single member-value pair in an annotation.ASTMemberValuePairs Represents a list of member values in an annotation.ASTMethodDeclaration Method declaration node.ASTMethodDeclarator Deprecated. This node will be removed with 7.0.0.ASTMethodReference ASTModuleDeclaration ASTModuleDirective ASTModuleName ASTMultiplicativeExpression Represents a multiplication, division, or modulo operation on two or more values.ASTName ASTNameList ASTNormalAnnotation Represents an annotation that with a parenthesized list of key-value pairs (possibly empty).ASTNullLiteral ASTPackageDeclaration ASTPostfixExpression Represents a unary postfix operation on a value.ASTPreDecrementExpression Represents a pre-decrement expression on a variable.ASTPreIncrementExpression Represents a pre-increment expression on a variable.ASTPrimaryExpression ASTPrimaryPrefix ASTPrimarySuffix ASTPrimitiveType Represents a primitive type.ASTRecordBody Defines the body of a RecordDeclaration (JDK 14 preview feature).ASTRecordComponent Defines a single component of a RecordDeclaration (JDK 14 preview feature).ASTRecordComponentList Defines the state description of a RecordDeclaration (JDK 14 preview feature).ASTRecordConstructorDeclaration This defines a compact constructor for a RecordDeclaration (JDK 14 preview feature).ASTRecordDeclaration A record declaration is a special data class type (JDK 14 preview feature).ASTReferenceType Represents a reference type, i.e.ASTRelationalExpression Represents a comparison on two numeric values.ASTResource ASTResources ASTResourceSpecification ASTResultType ASTReturnStatement ASTRSIGNEDSHIFT Deprecated. Will be removed in 7.0.0.ASTRUNSIGNEDSHIFT Deprecated. Will be removed in 7.0.0.ASTShiftExpression Represents a shift expression on a numeric value.ASTSingleMemberAnnotation Represents an annotation using the shorthand syntax for the default member.ASTStatement ASTStatementExpression ASTStatementExpressionList ASTSwitchExpression ASTSwitchLabel ASTSwitchLabeledBlock ASTSwitchLabeledExpression ASTSwitchLabeledThrowStatement ASTSwitchStatement Represents aswitch
statement.ASTSynchronizedStatement ASTThrowStatement ASTTryStatement Try statement node.ASTType Represents a type reference.ASTTypeArgument Represents a single type argument in a type arguments list.ASTTypeArguments Represents a list of type arguments.ASTTypeBound Represents a type bound on a type parameter.ASTTypeDeclaration ASTTypeParameter Represents a type parameter declaration of a method, constructor, class or interface declaration.ASTTypeParameters Represents a list of type parameters.ASTTypeTestPattern A type test pattern (JDK 14 preview feature).ASTUnaryExpression Represents a unary prefix operation on a value.ASTUnaryExpressionNotPlusMinus Represents a boolean negation or bitwise inverse operation.ASTVariableDeclarator Groups a variable ID and its initializer if it exists.ASTVariableDeclaratorId Represents an identifier in the context of variable or parameter declarations (not their use in expressions).ASTVariableInitializer ASTWhileStatement Represents awhile
statement.ASTWildcardBounds Represents a type bound on a wildcard type argument.ASTYieldStatement Comment CommentUtil Deprecated. This utility class is deprecated and will be removed with PMD 7.0.0.DummyJavaNode Deprecated. DumpFacade Deprecated. This class will be removed with PMD 7.FormalComment JavadocElement JavaParser Deprecated. JavaParserControllessVisitorAdapter Deprecated. Visitor decorators are deprecated because they lead to fragile code.JavaParserDecoratedVisitor Deprecated. Visitor decorators are deprecated because they lead to fragile code.JavaParserTokenManager Deprecated. JavaParserVisitorAdapter JavaParserVisitorDecorator Deprecated. Visitor decorators are deprecated because they lead to fragile code.JavaParserVisitorReducedAdapter Visitor adapter with convenient visit methods to e.g.JavaQualifiedName Deprecated. This class and subclasses will be removed in PMD 7.0 for lack of usefulness.JJTJavaParserState Deprecated. MultiLineComment SingleLineComment Token Deprecated. Token.GTToken -
Enum Summary Enum Description ASTAnyTypeBodyDeclaration.DeclarationKind Kind of declaration.ASTAnyTypeDeclaration.TypeKind Deprecated. This is not useful, not adapted to the problem, and does not scale to changes in the Java language.ASTModuleDirective.DirectiveType ASTModuleDirective.RequiresModifier MethodLikeNode.MethodLikeKind Deprecated. Same reason as forASTAnyTypeDeclaration.TypeKind
-
Exception Summary Exception Description ParseException Deprecated. Use superclassParseException