org.eclipse.jdt.core.dom |
Package-level Javadoc
The Java DOM/AST is the set of classes that model the source code of a Java program
as a structured document.
Package Specification
This package contains the Java DOM/AST classes. An API for manipulating the
source code of a Java program as a structured document. In particular, it provides
a full abstract syntax tree for a Java compilation unit, which can be queried for
resolved type information, and modified.
The principal classes are {@link org.eclipse.jdt.core.dom.AST AST}
{@link org.eclipse.jdt.core.dom.ASTNode ASTNode}, and
{@link org.eclipse.jdt.core.dom.ASTParser ASTParser}.
|
Java Source File Name | Type | Comment |
AbstractTypeDeclaration.java | Class | Abstract subclass for type declaration, enum declaration,
and annotation type declaration AST node types. |
Annotation.java | Class | Abstract base class of AST nodes that represent annotations. |
AnnotationBinding.java | Class | |
AnnotationTypeDeclaration.java | Class | Annotation type declaration AST node type (added in JLS3 API).
AnnotationTypeDeclaration:
[ Javadoc ] { ExtendedModifier } @ interface Identifier
{ { AnnotationTypeBodyDeclaration | ; } }
AnnotationTypeBodyDeclaration:
AnnotationTypeMemberDeclaration
FieldDeclaration
TypeDeclaration
EnumDeclaration
AnnotationTypeDeclaration
The thing to note is that method declaration are replaced
by annotation type member declarations in this context.
When a Javadoc comment is present, the source
range begins with the first character of the "/**" comment delimiter.
When there is no Javadoc comment, the source range begins with the first
character of the first modifier keyword (if modifiers), or the
first character of the "@interface" (if no
modifiers). |
AnnotationTypeMemberDeclaration.java | Class | Annotation type member declaration AST node type (added in JLS3 API).
AnnotationTypeMemberDeclaration:
[ Javadoc ] { ExtendedModifier }
Type Identifier ( ) [ default Expression ] ;
Note that annotation type member declarations are only meaningful as
elements of
AnnotationTypeDeclaration.bodyDeclarations .
When a Javadoc comment is present, the source
range begins with the first character of the "/**" comment delimiter.
When there is no Javadoc comment, the source range begins with the first
character of the first modifier keyword (if modifiers),
or the first character of the member type (no modifiers). |
AnonymousClassDeclaration.java | Class | Anonymous class declaration AST node type. |
ArrayAccess.java | Class | Array access expression AST node type. |
ArrayCreation.java | Class | Array creation expression AST node type. |
ArrayInitializer.java | Class | Array initializer AST node type. |
ArrayType.java | Class | Type node for an array type. |
AssertStatement.java | Class | Assert statement AST node type. |
Assignment.java | Class | Assignment expression AST node type. |
AST.java | Class | Umbrella owner and abstract syntax tree node factory.
An AST instance serves as the common owner of any number of
AST nodes, and as the factory for creating new AST nodes owned by that
instance.
Abstract syntax trees may be hand constructed by clients, using the
newTYPE factory methods to create new nodes, and the
various setCHILD methods
(see
org.eclipse.jdt.core.dom.ASTNode ASTNode and its subclasses)
to connect them together.
Each AST node belongs to a unique AST instance, called the owning AST.
The children of an AST node always have the same owner as their parent node.
If a node from one AST is to be added to a different AST, the subtree must
be cloned first to ensures that the added nodes have the correct owning AST.
There can be any number of AST nodes owned by a single AST instance that are
unparented. |
ASTConverter.java | Class | Internal class for converting internal compiler ASTs into public ASTs. |
ASTMatcher.java | Class | Concrete superclass and default implementation of an AST subtree matcher.
For example, to compute whether two ASTs subtrees are structurally
isomorphic, use n1.subtreeMatch(new ASTMatcher(), n2) where
n1 and n2 are the AST root nodes of the subtrees.
For each different concrete AST node type T there is a
public boolean match(T node, Object other) method
that matches the given node against another object (typically another
AST node, although this is not essential). |
ASTNode.java | Class | Abstract superclass of all Abstract Syntax Tree (AST) node types.
An AST node represents a Java source code construct, such
as a name, type, expression, statement, or declaration.
Each AST node belongs to a unique AST instance, called the owning AST.
The children of an AST node always have the same owner as their parent node.
If a node from one AST is to be added to a different AST, the subtree must
be cloned first to ensure that the added nodes have the correct owning AST.
When an AST node is part of an AST, it has a unique parent node.
Clients can navigate upwards, from child to parent, as well as downwards,
from parent to child. |
ASTParser.java | Class | A Java language parser for creating abstract syntax trees (ASTs).
Example: Create basic AST from source string
char[] source = ...;
ASTParser parser = ASTParser.newParser(AST.JLS3); // handles JDK 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6
parser.setSource(source);
CompilationUnit result = (CompilationUnit) parser.createAST(null);
Once a configured parser instance has been used to create an AST,
the settings are automatically reset to their defaults,
ready for the parser instance to be reused.
There are a number of configurable features:
|
ASTRecoveryPropagator.java | Class | Internal AST visitor for propagating syntax errors. |
ASTRequestor.java | Class | An AST requestor handles ASTs for compilation units passed to
ASTParser.createASTs . |
ASTSyntaxErrorPropagator.java | Class | Internal AST visitor for propagating syntax errors. |
ASTVisitor.java | Class | A visitor for abstract syntax trees.
For each different concrete AST node type T there are
a pair of methods:
public boolean visit(T node) - Visits
the given node to perform some arbitrary operation. |
BindingComparator.java | Class | Internal helper class for comparing bindings. |
BindingResolver.java | Class | A binding resolver is an internal mechanism for figuring out the binding
for a major declaration, type, or name reference. |
Block.java | Class | Block statement AST node type. |
BlockComment.java | Class | Block comment AST node type.
Block comments (also called "traditional" comments in JLS 3.7)
begin with "/*", may contain line breaks, and must end
with "*/". |
BodyDeclaration.java | Class | Abstract base class of all AST nodes that represent body declarations
that may appear in the body of some kind of class or interface declaration,
including anonymous class declarations, enumeration declarations, and
enumeration constant declarations.
For JLS2:
BodyDeclaration:
ClassDeclaration
InterfaceDeclaration
MethodDeclaration
ConstructorDeclaration
FieldDeclaration
Initializer
For JLS3, a number of new node types were introduced:
BodyDeclaration:
ClassDeclaration
InterfaceDeclaration
EnumDeclaration
MethodDeclaration
ConstructorDeclaration
FieldDeclaration
Initializer
EnumConstantDeclaration
AnnotationTypeDeclaration
AnnotationTypeMemberDeclaration
All types of body declarations carry modifiers (and annotations), although they differ in
which modifiers are allowed. |
BooleanLiteral.java | Class | Boolean literal node. |
BreakStatement.java | Class | Break statement AST node type. |
CastExpression.java | Class | Cast expression AST node type. |
CatchClause.java | Class | Catch clause AST node type. |
CharacterLiteral.java | Class | Character literal nodes. |
ChildListPropertyDescriptor.java | Class | Descriptor for a child list property of an AST node. |
ChildPropertyDescriptor.java | Class | Descriptor for a child property of an AST node. |
ClassInstanceCreation.java | Class | Class instance creation expression AST node type.
For JLS2:
ClassInstanceCreation:
[ Expression . ] new Name
( [ Expression { , Expression } ] )
[ AnonymousClassDeclaration ]
For JLS3, type arguments are added
and the type name is generalized to a type so that parameterized
types can be instantiated:
ClassInstanceCreation:
[ Expression . ]
new [ < Type { , Type } > ]
Type ( [ Expression { , Expression } ] )
[ AnonymousClassDeclaration ]
Not all node arragements will represent legal Java constructs. |
Comment.java | Class | Abstract base class for all AST nodes that represent comments. |
CompilationUnit.java | Class | Java compilation unit AST node type. |
CompilationUnitResolver.java | Class | |
ConditionalExpression.java | Class | Conditional expression AST node type. |
ConstructorInvocation.java | Class | Alternate constructor invocation statement AST node type. |
ContinueStatement.java | Class | Continue statement AST node type. |
DefaultASTVisitor.java | Class | |
DefaultBindingResolver.java | Class | Internal class for resolving bindings using old ASTs.
IMPORTANT: The methods on this class are synchronized. |
DefaultCommentMapper.java | Class | Internal class for associating comments with AST nodes. |
DefaultValuePairBinding.java | Class | Member value pair which compose of default values. |
DocCommentParser.java | Class | Internal parser used for decoding doc comments. |
DoStatement.java | Class | Do statement AST node type. |
EmptyStatement.java | Class | Null statement AST node type. |
EnhancedForStatement.java | Class | Enhanced For statement AST node type (added in JLS3 API). |
EnumConstantDeclaration.java | Class | Enumeration constant declaration AST node type (added in JLS3 API).
EnumConstantDeclaration:
[ Javadoc ] { ExtendedModifier } Identifier
[ ( [ Expression { , Expression } ] ) ]
[ AnonymousClassDeclaration ]
When a Javadoc comment is present, the source
range begins with the first character of the "/**" comment delimiter.
When there is no Javadoc comment, the source range begins with the first
character of the identifier. |
EnumDeclaration.java | Class | Enum declaration AST node type (added in JLS3 API).
EnumDeclaration:
[ Javadoc ] { ExtendedModifier } enum Identifier
[ implements Type { , Type } ]
{
[ EnumConstantDeclaration { , EnumConstantDeclaration } ] [ , ]
[ ; { ClassBodyDeclaration | ; } ]
}
The
EnumDeclaration.enumConstants() list holds the enum constant declarations,
while the
EnumDeclaration.bodyDeclarations() list holds the class body declarations
that appear after the semicolon.
When a Javadoc comment is present, the source
range begins with the first character of the "/**" comment delimiter.
When there is no Javadoc comment, the source range begins with the first
character of the first modifier or annotation (if present), or the
first character of the "enum" keyword (if no
modifiers or annotations). |
Expression.java | Class | Abstract base class of AST nodes that represent expressions. |
ExpressionStatement.java | Class | Expression statement AST node type. |
FieldAccess.java | Class | Field access expression AST node type.
FieldAccess:
Expression . Identifier
Note that there are several kinds of expressions that resemble field access
expressions: qualified names, this expressions, and super field access
expressions. |
FieldDeclaration.java | Class | Field declaration node type.
This kind of node collects several variable declaration fragments
(VariableDeclarationFragment ) into a single body declaration
(BodyDeclaration ), all sharing the same modifiers and base type.
FieldDeclaration:
[Javadoc] { ExtendedModifier } Type VariableDeclarationFragment
{ , VariableDeclarationFragment } ;
When a Javadoc comment is present, the source range begins with the first
character of the "/**" comment delimiter. |
ForStatement.java | Class | For statement AST node type. |
IAnnotationBinding.java | Interface | Represents an resolved annotation. |
IBinding.java | Interface | A binding represents a named entity in the Java language. |
IDocElement.java | Interface | Internal marker-type interface used to tag node types that can legitimately
be included in
TagElement.fragments TagElement.fragments() . |
IExtendedModifier.java | Interface | Common interface for AST nodes that represent modifiers or
annotations. |
IfStatement.java | Class | If statement AST node type. |
IMemberValuePairBinding.java | Interface | Represents a resolved instance of an annotation's member value pair. |
IMethodBinding.java | Interface | A method binding represents a method or constructor of a class or interface. |
ImportDeclaration.java | Class | Import declaration AST node type. |
InfixExpression.java | Class | Infix expression AST node type. |
Initializer.java | Class | Static or instance initializer AST node type. |
InstanceofExpression.java | Class | Instanceof expression AST node type. |
InternalASTRewrite.java | Class | Internal class: not intended to be used by client. |
IPackageBinding.java | Interface | A package binding represents a named or unnamed package. |
ITypeBinding.java | Interface | A type binding represents fully-resolved type. |
IVariableBinding.java | Interface | A variable binding represents either a field of a class or interface, or
a local variable declaration (including formal parameters, local variables,
and exception variables). |
Javadoc.java | Class | AST node for a Javadoc-style doc comment. |
LabeledStatement.java | Class | Labeled statement AST node type. |
LineComment.java | Class | End-of-line comment AST node type.
End-of-line comments begin with "//",
must end with a line delimiter (as per JLS 3.7),
and must not contain line breaks.
Note that this node type is a comment placeholder, and is
only useful for recording the source range where a comment
was found in a source string. |
MarkerAnnotation.java | Class | Marker annotation node (added in JLS3 API). |
MemberRef.java | Class | AST node for a member reference within a doc comment
(
Javadoc ). |
MemberValuePair.java | Class | Member value pair node (added in JLS3 API). |
MemberValuePairBinding.java | Class | Internal class. |
Message.java | Class | Error message used to report potential errors found during the AST parsing
or name resolution. |
MethodBinding.java | Class | Internal implementation of method bindings. |
MethodDeclaration.java | Class | Method declaration AST node type. |
MethodInvocation.java | Class | Method invocation expression AST node type. |
MethodRef.java | Class | AST node for a method or constructor reference within a doc comment
(
Javadoc ). |
MethodRefParameter.java | Class | AST node for a parameter within a method reference (
MethodRef ).
These nodes only occur within doc comments (
Javadoc ).
For JLS2:
MethodRefParameter:
Type [ Identifier ]
For JLS3, the variable arity indicator was added:
MethodRefParameter:
Type [ ... ] [ Identifier ]
Note: The 1.5 spec for the Javadoc tool does not mention the possibility
of a variable arity indicator in method references. |
Modifier.java | Class | Modifier node. |
NaiveASTFlattener.java | Class | Internal AST visitor for serializing an AST in a quick and dirty fashion.
For various reasons the resulting string is not necessarily legal
Java code; and even if it is legal Java code, it is not necessarily the string
that corresponds to the given AST. |
Name.java | Class | Abstract base class for all AST nodes that represent names. |
NodeEventHandler.java | Class | A node event handler is an internal mechanism for receiving
notification of changes to nodes in an AST.
The default implementation serves as the default event handler
that does nothing. |
NodeSearcher.java | Class | |
NormalAnnotation.java | Class | Normal annotation node (added in JLS3 API). |
NullLiteral.java | Class | Null literal node. |
NumberLiteral.java | Class | Number literal nodes. |
PackageBinding.java | Class | Internal implementation of package bindings. |
PackageDeclaration.java | Class | Package declaration AST node type. |
ParameterizedType.java | Class | Type node for a parameterized type (added in JLS3 API). |
ParenthesizedExpression.java | Class | Parenthesized expression AST node type. |
PostfixExpression.java | Class | Postfix expression AST node type. |
PrefixExpression.java | Class | Prefix expression AST node type. |
PrimitiveType.java | Class | Primitive type nodes. |
QualifiedName.java | Class | AST node for a qualified name. |
QualifiedType.java | Class | Type node for a qualified type (added in JLS3 API).
QualifiedType:
Type . SimpleName
Not all node arragements will represent legal Java constructs. |
RecoveredTypeBinding.java | Class | |
RecoveredVariableBinding.java | Class | |
ReturnStatement.java | Class | Return statement AST node type. |
SimpleName.java | Class | AST node for a simple name. |
SimplePropertyDescriptor.java | Class | Descriptor for a simple property of an AST node. |
SimpleType.java | Class | Type node for a named class type, a named interface type, or a type variable. |
SingleMemberAnnotation.java | Class | Single member annotation node (added in JLS3 API). |
SingleVariableDeclaration.java | Class | Single variable declaration AST node type. |
Statement.java | Class | Abstract base class of AST nodes that represent statements. |
StringLiteral.java | Class | String literal nodes. |
StructuralPropertyDescriptor.java | Class | Abstract base class for property descriptors of AST nodes. |
SuperConstructorInvocation.java | Class | Super constructor invocation statement AST node type. |
SuperFieldAccess.java | Class | Simple or qualified "super" field access expression AST node type. |
SuperMethodInvocation.java | Class | Simple or qualified "super" method invocation expression AST node type. |
SwitchCase.java | Class | Switch case AST node type. |
SwitchStatement.java | Class | Switch statement AST node type. |
SynchronizedStatement.java | Class | Synchronized statement AST node type. |
TagElement.java | Class | AST node for a tag within a doc comment. |
TextElement.java | Class | AST node for a text element within a doc comment. |
ThisExpression.java | Class | Simple or qualified "this" AST node type. |
ThrowStatement.java | Class | Throw statement AST node type. |
TryStatement.java | Class | Try statement AST node type. |
Type.java | Class | Abstract base class of all type AST node types. |
TypeBinding.java | Class | Internal implementation of type bindings. |
TypeDeclaration.java | Class | Type declaration AST node type. |
TypeDeclarationStatement.java | Class | Local type declaration statement AST node type. |
TypeLiteral.java | Class | Type literal AST node type. |
TypeParameter.java | Class | Type parameter node (added in JLS3 API). |
VariableBinding.java | Class | Internal implementation of variable bindings. |
VariableDeclaration.java | Class | Abstract base class of all AST node types that declare a single local
variable. |
VariableDeclarationExpression.java | Class | Local variable declaration expression AST node type. |
VariableDeclarationFragment.java | Class | Variable declaration fragment AST node type, used in field declarations,
local variable declarations, and ForStatement initializers. |
VariableDeclarationStatement.java | Class | Local variable declaration statement AST node type.
This kind of node collects several variable declaration fragments
(VariableDeclarationFragment ) into a statement
(Statement ), all sharing the same modifiers and base type.
For JLS2:
VariableDeclarationStatement:
{ Modifier } Type VariableDeclarationFragment
{ , VariableDeclarationFragment } ;
For JLS3, the modifier flags were replaced by
a list of modifier nodes (intermixed with annotations):
VariableDeclarationStatement:
{ ExtendedModifier } Type VariableDeclarationFragment
{ , VariableDeclarationFragment } ;
Note: This type of node is a convenience of sorts. |
WhileStatement.java | Class | While statement AST node type. |
WildcardType.java | Class | Type node for a wildcard type (added in JLS3 API).
WildcardType:
? [ ( extends | super) Type ]
Not all node arrangements will represent legal Java constructs. |