public class TreeInfo extends Object
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.
Modifier and Type | Field and Description |
---|---|
static int |
addPrec
Operator precedences values.
|
static int |
andPrec
Operator precedences values.
|
static int |
assignopPrec
Operator precedences values.
|
static int |
assignPrec
Operator precedences values.
|
static int |
bitandPrec
Operator precedences values.
|
static int |
bitorPrec
Operator precedences values.
|
static int |
bitxorPrec
Operator precedences values.
|
static int |
condPrec
Operator precedences values.
|
static int |
eqPrec
Operator precedences values.
|
static int |
mulPrec
Operator precedences values.
|
static int |
noPrec
Operator precedences values.
|
static int |
notExpression
Operator precedences values.
|
static int |
ordPrec
Operator precedences values.
|
static int |
orPrec
Operator precedences values.
|
static int |
postfixPrec
Operator precedences values.
|
static int |
precCount
Operator precedences values.
|
static int |
prefixPrec
Operator precedences values.
|
static int |
shiftPrec
Operator precedences values.
|
protected static Context.Key<TreeInfo> |
treeInfoKey |
Modifier and Type | Method and Description |
---|---|
static List<JCTree.JCExpression> |
args(JCTree t) |
static Name |
calledMethodName(JCTree tree)
If the expression is a method call, return the method name, null
otherwise.
|
static boolean |
containsTypeAnnotation(JCTree e) |
static JCTree |
declarationFor(Symbol sym,
JCTree tree)
Find the declaration for a symbol, where
that symbol is defined somewhere in the given tree.
|
static JCDiagnostic.DiagnosticPosition |
diagEndPos(JCTree tree)
A DiagnosticPosition with the preferred position set to the
end position of given tree, if it is a block with
defined endpos.
|
static JCDiagnostic.DiagnosticPosition |
diagnosticPositionFor(Symbol sym,
JCTree tree)
Find the position for reporting an error about a symbol, where
that symbol is defined somewhere in the given tree.
|
static int |
endPos(JCTree tree)
The end position of given tree, if it is a block with
defined endpos.
|
static int |
finalizerPos(JCTree tree)
The position of the finalizer of given try/synchronized statement.
|
static JCTree.JCMethodInvocation |
firstConstructorCall(JCTree tree)
Return the first call in a constructor definition.
|
static long |
firstFlag(long flags)
Return first (smallest) flag in `flags':
pre: flags != 0
|
static int |
firstStatPos(JCTree tree)
The position of the first statement in a block, or the position of
the block itself if it is empty.
|
static String |
flagNames(long flags)
Return flags as a string, separated by " ".
|
static long |
flags(JCTree tree)
If this tree is a declaration or a block, return its flags field,
otherwise return 0.
|
static Name |
fullName(JCTree tree)
If this tree is a qualified identifier, its return fully qualified name,
otherwise return null.
|
static String |
getCommentText(Env<?> env,
JCTree tree) |
static DCTree.DCDocComment |
getCommentTree(Env<?> env,
JCTree tree) |
static int |
getEndPos(JCTree tree,
EndPosTable endPosTable)
The end position of given tree, given a table of end positions generated by the parser
|
static int |
getStartPos(JCTree tree)
Get the start position for a tree node.
|
static boolean |
hasConstructors(List<JCTree> trees)
Is there a constructor declaration in the given list of trees?
|
static JCTree |
innermostType(JCTree type) |
static TreeInfo |
instance(Context context) |
static boolean |
isConstructor(JCTree tree)
Is tree a constructor declaration?
|
static boolean |
isDeclaration(JCTree node) |
static boolean |
isDiamond(JCTree tree)
Return true if a tree represents a diamond new expr.
|
static boolean |
isEnumInit(JCTree tree) |
static boolean |
isExpressionStatement(JCTree.JCExpression tree)
Return true if the tree corresponds to an expression statement
|
static boolean |
isInitialConstructor(JCTree tree)
Is this a constructor whose first (non-synthetic) statement is not
of the form this(...)?
|
static boolean |
isMultiCatch(JCTree.JCCatch catchClause) |
static boolean |
isNull(JCTree tree)
Return true if a tree represents the null literal.
|
static boolean |
isSelfCall(JCTree tree)
Is this a call to this or super?
|
static boolean |
isStaticSelector(JCTree base,
Names names)
Return true if the AST corresponds to a static select of the kind A.B
|
static boolean |
isSuperCall(JCTree tree)
Is this a call to super?
|
static boolean |
isSyntheticInit(JCTree stat)
Is statement an initializer for a synthetic field?
|
static Name |
name(JCTree tree)
If this tree is an identifier or a field or a parameterized type,
return its name, otherwise return null.
|
static boolean |
nonstaticSelect(JCTree tree)
Return true if this is a nonstatic selection.
|
Name |
operatorName(JCTree.Tag tag)
Return name of operator with given tree tag.
|
static int |
opPrec(JCTree.Tag op)
Map operators to their precedence levels.
|
static List<JCTree> |
pathFor(JCTree node,
JCTree.JCCompilationUnit unit) |
static int |
positionFor(Symbol sym,
JCTree tree)
Find the position for reporting an error about a symbol, where
that symbol is defined somewhere in the given tree.
|
static JCTree |
referencedStatement(JCTree.JCLabeledStatement tree)
Return the statement referenced by a label.
|
static Env<AttrContext> |
scopeFor(JCTree node,
JCTree.JCCompilationUnit unit) |
static Env<AttrContext> |
scopeFor(List<JCTree> path) |
static void |
setPolyKind(JCTree tree,
JCTree.JCPolyExpression.PolyKind pkind)
set 'polyKind' on given tree
|
static void |
setSymbol(JCTree tree,
Symbol sym)
If this tree is an identifier or a field, set its symbol, otherwise skip.
|
static void |
setVarargsElement(JCTree tree,
Type varargsElement)
set 'varargsElement' on given tree
|
static JCTree.JCExpression |
skipParens(JCTree.JCExpression tree)
Skip parens and return the enclosed expression
|
static JCTree |
skipParens(JCTree tree)
Skip parens and return the enclosed expression
|
static Symbol |
symbol(JCTree tree)
If this tree is an identifier or a field, return its symbol,
otherwise return null.
|
static Symbol |
symbolFor(JCTree node) |
static JCTree.JCExpression |
typeIn(JCTree.JCExpression tree)
Returns the underlying type of the tree if it is an annotated type,
or the tree itself otherwise.
|
static List<Type> |
types(List<? extends JCTree> trees)
Return the types of a list of trees.
|
protected static final Context.Key<TreeInfo> treeInfoKey
public static final int notExpression
public static final int noPrec
public static final int assignPrec
public static final int assignopPrec
public static final int condPrec
public static final int orPrec
public static final int andPrec
public static final int bitorPrec
public static final int bitxorPrec
public static final int bitandPrec
public static final int eqPrec
public static final int ordPrec
public static final int shiftPrec
public static final int addPrec
public static final int mulPrec
public static final int prefixPrec
public static final int postfixPrec
public static final int precCount
public static List<JCTree.JCExpression> args(JCTree t)
public Name operatorName(JCTree.Tag tag)
public static boolean isConstructor(JCTree tree)
public static boolean hasConstructors(List<JCTree> trees)
public static boolean isMultiCatch(JCTree.JCCatch catchClause)
public static boolean isSyntheticInit(JCTree stat)
public static Name calledMethodName(JCTree tree)
public static boolean isSelfCall(JCTree tree)
public static boolean isSuperCall(JCTree tree)
public static boolean isInitialConstructor(JCTree tree)
public static JCTree.JCMethodInvocation firstConstructorCall(JCTree tree)
public static boolean isDiamond(JCTree tree)
public static boolean isEnumInit(JCTree tree)
public static void setPolyKind(JCTree tree, JCTree.JCPolyExpression.PolyKind pkind)
public static void setVarargsElement(JCTree tree, Type varargsElement)
public static boolean isExpressionStatement(JCTree.JCExpression tree)
public static boolean isStaticSelector(JCTree base, Names names)
public static boolean isNull(JCTree tree)
public static DCTree.DCDocComment getCommentTree(Env<?> env, JCTree tree)
public static int firstStatPos(JCTree tree)
public static int endPos(JCTree tree)
public static int getStartPos(JCTree tree)
tree
- The tree nodepublic static int getEndPos(JCTree tree, EndPosTable endPosTable)
public static JCDiagnostic.DiagnosticPosition diagEndPos(JCTree tree)
public static int finalizerPos(JCTree tree)
public static int positionFor(Symbol sym, JCTree tree)
public static JCDiagnostic.DiagnosticPosition diagnosticPositionFor(Symbol sym, JCTree tree)
public static JCTree declarationFor(Symbol sym, JCTree tree)
public static Env<AttrContext> scopeFor(JCTree node, JCTree.JCCompilationUnit unit)
public static Env<AttrContext> scopeFor(List<JCTree> path)
public static List<JCTree> pathFor(JCTree node, JCTree.JCCompilationUnit unit)
public static JCTree referencedStatement(JCTree.JCLabeledStatement tree)
public static JCTree.JCExpression skipParens(JCTree.JCExpression tree)
public static JCTree skipParens(JCTree tree)
public static List<Type> types(List<? extends JCTree> trees)
public static Name name(JCTree tree)
public static Name fullName(JCTree tree)
public static boolean isDeclaration(JCTree node)
public static Symbol symbol(JCTree tree)
public static boolean nonstaticSelect(JCTree tree)
public static void setSymbol(JCTree tree, Symbol sym)
public static long flags(JCTree tree)
public static long firstFlag(long flags)
public static String flagNames(long flags)
public static int opPrec(JCTree.Tag op)
public static JCTree.JCExpression typeIn(JCTree.JCExpression tree)
public static boolean containsTypeAnnotation(JCTree e)
Copyright © 2015. All rights reserved.