|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.tools.javac.tree.TreeInfo
public class TreeInfo
Utility class containing inspector methods for trees.
This is NOT part of any API supported by Sun Microsystems. 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.
| Field Summary | |
|---|---|
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. |
private Name[] |
opname
The names of all operators. |
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
|
| Constructor Summary | |
|---|---|
private |
TreeInfo(Context context)
|
| Method Summary | |
|---|---|
static Name |
calledMethodName(JCTree tree)
If the expression is a method call, return the method name, null otherwise. |
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 java.lang.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 int |
getEndPos(JCTree tree,
java.util.Map<JCTree,java.lang.Integer> endPositions)
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 TreeInfo |
instance(Context context)
|
static boolean |
isConstructor(JCTree tree)
Is tree a constructor declaration? |
static boolean |
isInitialConstructor(JCTree tree)
Is this a constructor whose first (non-synthetic) statement is not of the form this(...)? |
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 |
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(int tag)
Return name of operator with given tree tag. |
static int |
opPrec(int 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 |
setSymbol(JCTree tree,
Symbol sym)
If this tree is an identifier or a field, set its symbol, otherwise skip. |
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)
|
(package private) static Tree.Kind |
tagToKind(int tag)
|
static List<Type> |
types(List<? extends JCTree> trees)
Return the types of a list of trees. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final Context.Key<TreeInfo> treeInfoKey
private Name[] opname
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
| Constructor Detail |
|---|
private TreeInfo(Context context)
| Method Detail |
|---|
public static TreeInfo instance(Context context)
public Name operatorName(int tag)
public static boolean isConstructor(JCTree tree)
public static boolean hasConstructors(List<JCTree> trees)
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 isNull(JCTree tree)
public static int firstStatPos(JCTree tree)
public static int endPos(JCTree tree)
public static int getStartPos(JCTree tree)
tree - The tree node
public static int getEndPos(JCTree tree,
java.util.Map<JCTree,java.lang.Integer> endPositions)
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 Symbol symbolFor(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 java.lang.String flagNames(long flags)
public static int opPrec(int op)
static Tree.Kind tagToKind(int tag)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||