public abstract class JCTree extends Object implements Tree, Cloneable, JCDiagnostic.DiagnosticPosition
Each subclass is highly standardized. It generally contains only tree fields for the syntactic subcomponents of the node. Some classes that represent identifier uses or definitions also define a Symbol field that denotes the represented identifier. Classes for non-local jumps also carry the jump target as a field. The root class Tree itself defines fields for the tree's type and position. No other fields are kept in a tree node; instead parameters are passed to methods accessing the node.
Except for the methods defined by com.sun.source, the only method defined in subclasses is `visit' which applies a given visitor to the tree. The actual tree processing is done by visitor classes in other packages. The abstract class Visitor, as well as an Factory interface for trees, are defined as inner classes in Tree.
To avoid ambiguities with the Tree API in com.sun.source all sub classes should, by convention, start with JC (javac).
This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
TreeMaker
,
TreeInfo
,
TreeTranslator
,
Pretty
Modifier and Type | Class and Description |
---|---|
static interface |
JCTree.Factory
An interface for tree factories
|
static class |
JCTree.JCAnnotatedType |
static class |
JCTree.JCAnnotation |
static class |
JCTree.JCArrayAccess
An array selection
|
static class |
JCTree.JCArrayTypeTree
An array type, A[]
|
static class |
JCTree.JCAssert
An assert statement.
|
static class |
JCTree.JCAssign
A assignment with "=".
|
static class |
JCTree.JCAssignOp
An assignment with "+=", "|=" ...
|
static class |
JCTree.JCBinary
A binary operation.
|
static class |
JCTree.JCBlock
A statement block.
|
static class |
JCTree.JCBreak
A break from a loop or switch.
|
static class |
JCTree.JCCase
A "case :" of a switch.
|
static class |
JCTree.JCCatch
A catch block.
|
static class |
JCTree.JCClassDecl
A class definition.
|
static class |
JCTree.JCCompilationUnit
Everything in one source file is kept in a JCTree.JCCompilationUnit structure.
|
static class |
JCTree.JCConditional
A ( ) ? ( ) : ( ) conditional expression
|
static class |
JCTree.JCContinue
A continue of a loop.
|
static class |
JCTree.JCDoWhileLoop
A do loop
|
static class |
JCTree.JCEnhancedForLoop
The enhanced for loop.
|
static class |
JCTree.JCErroneous |
static class |
JCTree.JCExpression |
static class |
JCTree.JCExpressionStatement
an expression statement
|
static class |
JCTree.JCFieldAccess
Selects through packages and classes
|
static class |
JCTree.JCForLoop
A for loop.
|
static class |
JCTree.JCFunctionalExpression
Common supertype for all functional expression trees (lambda and method references)
|
static class |
JCTree.JCIdent
An identifier
|
static class |
JCTree.JCIf
An "if ( ) { } else { }" block
|
static class |
JCTree.JCImport
An import clause.
|
static class |
JCTree.JCInstanceOf
A type test.
|
static class |
JCTree.JCLabeledStatement
A labelled expression or statement.
|
static class |
JCTree.JCLambda
A lambda expression.
|
static class |
JCTree.JCLiteral
A constant value given literally.
|
static class |
JCTree.JCMemberReference
Selects a member expression.
|
static class |
JCTree.JCMethodDecl
A method definition.
|
static class |
JCTree.JCMethodInvocation
A method invocation
|
static class |
JCTree.JCModifiers |
static class |
JCTree.JCNewArray
A new[...] operation.
|
static class |
JCTree.JCNewClass
A new(...) operation.
|
static class |
JCTree.JCParens
A parenthesized subexpression ( ...
|
static class |
JCTree.JCPolyExpression
Common supertype for all poly expression trees (lambda, method references,
conditionals, method and constructor calls)
|
static class |
JCTree.JCPrimitiveTypeTree
Identifies a basic type.
|
static class |
JCTree.JCReturn
A return statement.
|
static class |
JCTree.JCSkip
A no-op statement ";".
|
static class |
JCTree.JCStatement |
static class |
JCTree.JCSwitch
A "switch ( ) { }" construction.
|
static class |
JCTree.JCSynchronized
A synchronized block.
|
static class |
JCTree.JCThrow
A throw statement.
|
static class |
JCTree.JCTry
A "try { } catch ( ) { } finally { }" block.
|
static class |
JCTree.JCTypeApply
A parameterized type, T<...>
|
static class |
JCTree.JCTypeCast
A type cast.
|
static class |
JCTree.JCTypeIntersection
An intersection type, T1 & T2 & ...
|
static class |
JCTree.JCTypeParameter
A formal class parameter.
|
static class |
JCTree.JCTypeUnion
A union type, T1 | T2 | ...
|
static class |
JCTree.JCUnary
A unary operation.
|
static class |
JCTree.JCVariableDecl
A variable definition.
|
static class |
JCTree.JCWhileLoop
A while loop
|
static class |
JCTree.JCWildcard |
static class |
JCTree.LetExpr
(let int x = 3; in x+2)
|
static class |
JCTree.Tag |
static class |
JCTree.TypeBoundKind |
static class |
JCTree.Visitor
A generic visitor class for trees.
|
Constructor and Description |
---|
JCTree() |
Modifier and Type | Method and Description |
---|---|
abstract void |
accept(JCTree.Visitor v)
Visit this tree with a given visitor.
|
abstract <R,D> R |
accept(TreeVisitor<R,D> v,
D d)
Accept method used to implement the visitor pattern.
|
Object |
clone()
Return a shallow copy of this tree.
|
int |
getEndPosition(EndPosTable endPosTable)
If there is a tree node, and if endPositions are available, get
the end position of the tree node.
|
int |
getPreferredPosition()
Get the position within the file that most accurately defines the
location for the diagnostic.
|
int |
getStartPosition()
If there is a tree node, get the start position of the tree node.
|
abstract JCTree.Tag |
getTag() |
JCTree |
getTree()
Gets the tree node, if any, to which the diagnostic applies.
|
boolean |
hasTag(JCTree.Tag tag) |
JCDiagnostic.DiagnosticPosition |
pos()
Get a default position for this tree node.
|
JCTree |
setPos(int pos)
Set position field and return this tree.
|
JCTree |
setType(Type type)
Set type field and return this tree.
|
String |
toString()
Convert a tree to a pretty-printed string.
|
public int pos
public Type type
public abstract JCTree.Tag getTag()
public boolean hasTag(JCTree.Tag tag)
public String toString()
public JCTree setPos(int pos)
public abstract void accept(JCTree.Visitor v)
public abstract <R,D> R accept(TreeVisitor<R,D> v, D d)
Tree
public JCDiagnostic.DiagnosticPosition pos()
public JCTree getTree()
JCDiagnostic.DiagnosticPosition
getTree
in interface JCDiagnostic.DiagnosticPosition
public int getStartPosition()
JCDiagnostic.DiagnosticPosition
getStartPosition
in interface JCDiagnostic.DiagnosticPosition
public int getPreferredPosition()
JCDiagnostic.DiagnosticPosition
getPreferredPosition
in interface JCDiagnostic.DiagnosticPosition
public int getEndPosition(EndPosTable endPosTable)
JCDiagnostic.DiagnosticPosition
getEndPosition
in interface JCDiagnostic.DiagnosticPosition
Copyright © 2016. All rights reserved.