protected static class CFGBuilder.CFGTranslationPhaseOne extends com.sun.source.util.TreePathScanner<Node,java.lang.Void>
CFGBuilder.Label
s to positions in the node sequence.
Node
s.
The return type of this scanner is Node
. For expressions, the corresponding node
is returned to allow linking between different nodes.
However, for statements there is usually no single Node
that is created, and thus
no node is returned (rather, null is returned).
Every visit*
method is assumed to add at least one extended node to the list of
nodes (which might only be a jump).
Modifier and Type | Field and Description |
---|---|
protected AnnotationProvider |
annotationProvider |
protected boolean |
assumeAssertionsDisabled
Can assertions be assumed to be disabled?
|
protected boolean |
assumeAssertionsEnabled
Can assertions be assumed to be enabled?
|
protected java.util.Map<CFGBuilder.Label,java.lang.Integer> |
bindings
The bindings of labels to positions (i.e., indices) in the
nodeList . |
protected java.util.Map<javax.lang.model.element.Name,CFGBuilder.Label> |
breakLabels
Map from AST label Names to CFG
CFGBuilder.Label s for breaks. |
protected @Nullable CFGBuilder.TryFinallyScopeCell |
breakTargetL
Current
CFGBuilder.TryFinallyScopeCell to which a break statement with no label should jump,
or null if there is no valid destination. |
protected java.util.Map<javax.lang.model.element.Name,CFGBuilder.Label> |
continueLabels
Map from AST label Names to CFG
CFGBuilder.Label s for continues. |
protected @Nullable CFGBuilder.TryFinallyScopeCell |
continueTargetL
Current
CFGBuilder.TryFinallyScopeCell to which a continue statement with no label should
jump, or null if there is no valid destination. |
protected java.util.IdentityHashMap<com.sun.source.tree.Tree,java.util.Set<Node>> |
convertedTreeLookupMap
Map from AST
Tree s to post-conversion sets of Node s. |
protected java.util.List<com.sun.source.tree.ClassTree> |
declaredClasses
Class declarations that have been encountered when building the control-flow graph for a
method.
|
protected java.util.List<com.sun.source.tree.LambdaExpressionTree> |
declaredLambdas
Lambdas encountered when building the control-flow graph for a method, variable
initializer, or initializer.
|
protected com.sun.source.tree.VariableTree |
ea
The
VariableTree that indicates whether assertions are enabled or not. |
protected javax.lang.model.util.Elements |
elements |
protected javax.annotation.processing.ProcessingEnvironment |
env
Annotation processing environment and its associated type and tree utilities.
|
protected CFGBuilder.Label |
exceptionalExitLabel
Special label to identify the exceptional exit.
|
protected java.util.Set<java.lang.Integer> |
leaders
The set of leaders (represented as indices into
nodeList ). |
protected java.util.ArrayList<CFGBuilder.ExtendedNode> |
nodeList
The list of extended nodes.
|
protected CFGBuilder.Label |
regularExitLabel
Special label to identify the regular exit.
|
protected @Nullable CFGBuilder.TryFinallyScopeCell |
returnTargetL
Current
CFGBuilder.TryFinallyScopeCell to which a return statement should jump, or null if
there is no valid destination. |
protected TreeBuilder |
treeBuilder |
protected java.util.IdentityHashMap<com.sun.source.tree.Tree,java.util.Set<Node>> |
treeLookupMap
Maps from AST
Tree s to sets of Node s. |
protected com.sun.source.util.Trees |
trees |
protected javax.lang.model.util.Types |
types |
protected long |
uid |
protected java.util.IdentityHashMap<com.sun.source.tree.UnaryTree,AssignmentNode> |
unaryAssignNodeLookupMap
Map from AST
UnaryTree s to compound AssignmentNode s. |
Constructor and Description |
---|
CFGTranslationPhaseOne(TreeBuilder treeBuilder,
AnnotationProvider annotationProvider,
boolean assumeAssertionsEnabled,
boolean assumeAssertionsDisabled,
javax.annotation.processing.ProcessingEnvironment env) |
Modifier and Type | Method and Description |
---|---|
protected void |
addLabelForNextNode(CFGBuilder.Label l)
Add the label
l to the extended node that will be placed next in the sequence. |
protected void |
addToConvertedLookupMap(Node node)
Add a node in the post-conversion lookup map.
|
protected void |
addToConvertedLookupMap(com.sun.source.tree.Tree tree,
Node node)
Add a node in the post-conversion lookup map.
|
protected void |
addToLookupMap(Node node)
Add a node to the lookup map if it not already present.
|
protected void |
addToUnaryAssignLookupMap(com.sun.source.tree.UnaryTree tree,
AssignmentNode unaryAssignNode)
Add a unary tree in the compound assign lookup map.
|
protected Node |
assignConvert(Node node,
javax.lang.model.type.TypeMirror varType)
Perform assignment conversion so that it can be assigned to a variable of the given type.
|
protected boolean |
assumeAssertionsEnabledFor(com.sun.source.tree.AssertTree tree)
Should assertions be assumed to be executed for a given
AssertTree ? False by
default. |
protected Node |
binaryNumericPromotion(Node node,
javax.lang.model.type.TypeMirror exprType)
Perform binary numeric promotion on the input node to make it match the expression type.
|
protected javax.lang.model.type.TypeMirror |
binaryPromotedType(javax.lang.model.type.TypeMirror left,
javax.lang.model.type.TypeMirror right)
Compute the type to which two numeric types must be promoted before performing a binary
numeric operation on them.
|
protected Node |
box(Node node)
If the input node is an unboxed primitive type, insert a call to the appropriate valueOf
method, otherwise leave it alone.
|
protected Node |
commonConvert(Node node,
javax.lang.model.type.TypeMirror varType,
boolean contextAllowsNarrowing)
Assignment conversion and method invocation conversion are almost identical, except that
assignment conversion allows narrowing.
|
protected Node |
conditionalExprPromotion(Node node,
javax.lang.model.type.TypeMirror destType)
Convert an operand of a conditional expression to the type of the whole expression.
|
protected boolean |
conversionRequiresNarrowing(javax.lang.model.type.TypeMirror varType,
Node node)
Return whether a conversion from the type of the node to varType requires narrowing.
|
protected java.util.List<Node> |
convertCallArguments(javax.lang.model.element.ExecutableElement method,
java.util.List<? extends com.sun.source.tree.ExpressionTree> actualExprs)
Given a method element and as list of argument expressions, return a list of
Node s representing the arguments converted for a call of the method. |
protected com.sun.source.tree.VariableTree |
createEnhancedForLoopArrayVariable(com.sun.source.tree.ExpressionTree expression,
javax.lang.model.element.VariableElement variableElement) |
protected com.sun.source.tree.VariableTree |
createEnhancedForLoopIteratorVariable(com.sun.source.tree.MethodInvocationTree iteratorCall,
javax.lang.model.element.VariableElement variableElement) |
protected void |
extendWithExtendedNode(CFGBuilder.ExtendedNode n)
Extend the list of extended nodes with an extended node.
|
protected <T extends Node> |
extendWithNode(T node)
Extend the list of extended nodes with a node.
|
protected CFGBuilder.NodeWithExceptionsHolder |
extendWithNodeWithException(Node node,
javax.lang.model.type.TypeMirror cause)
Extend the list of extended nodes with a node, where
node might throw the
exception cause . |
protected CFGBuilder.NodeWithExceptionsHolder |
extendWithNodeWithExceptions(Node node,
java.util.Set<javax.lang.model.type.TypeMirror> causes)
Extend the list of extended nodes with a node, where
node might throw any of the
exception in causes . |
protected com.sun.source.tree.VariableTree |
getAssertionsEnabledVariable()
Get a synthetic
VariableTree that indicates whether assertions are enabled or
not. |
protected @Nullable javax.lang.model.element.Name |
getLabel(com.sun.source.util.TreePath path)
Returns the label
Name of the leaf in the argument path, or null if the leaf is
not a labeled statement. |
void |
handleArtificialTree(com.sun.source.tree.Tree tree)
Perform any actions required when CFG translation creates a new Tree that is not part of
the original AST.
|
protected void |
insertExtendedNodeAfter(CFGBuilder.ExtendedNode n,
Node pred)
Insert
n after the node pred in the list of extended nodes, or append
n if pred is not present. |
protected <T extends Node> |
insertNodeAfter(T node,
Node pred)
Insert
node after pred in the list of extended nodes, or append to the
list if pred is not present. |
protected CFGBuilder.NodeWithExceptionsHolder |
insertNodeWithExceptionsAfter(Node node,
java.util.Set<javax.lang.model.type.TypeMirror> causes,
Node pred)
Insert a
node that might throw the exception cause after pred in
the list of extended nodes, or append to the list if pred is not present. |
protected boolean |
isNumericOrBoxed(javax.lang.model.type.TypeMirror type)
Returns true if the argument type is a numeric primitive or a boxed numeric primitive and
false otherwise.
|
protected Node |
methodInvocationConvert(Node node,
javax.lang.model.type.TypeMirror formalType)
Perform method invocation conversion so that the node can be passed as a formal parameter
of the given type.
|
protected Node |
narrow(Node node,
javax.lang.model.type.TypeMirror destType)
Perform narrowing conversion on the input node to make it match the destination type.
|
protected Node |
narrowAndBox(Node node,
javax.lang.model.type.TypeMirror destType)
Perform narrowing conversion and optionally boxing conversion on the input node to make
it match the destination type.
|
CFGBuilder.PhaseOneResult |
process(com.sun.source.tree.CompilationUnitTree root,
UnderlyingAST underlyingAST) |
CFGBuilder.PhaseOneResult |
process(com.sun.source.util.TreePath bodyPath,
UnderlyingAST underlyingAST)
Performs the actual work of phase one.
|
protected Node |
stringConversion(Node node)
Convert the input node to String type, if it isn't already.
|
protected void |
translateAssertWithAssertionsEnabled(com.sun.source.tree.AssertTree tree)
Translates an assertion statement to the correct CFG nodes.
|
protected AssignmentNode |
translateAssignment(com.sun.source.tree.Tree tree,
Node target,
com.sun.source.tree.ExpressionTree rhs)
Translate an assignment.
|
protected AssignmentNode |
translateAssignment(com.sun.source.tree.Tree tree,
Node target,
Node expression)
Translate an assignment where the RHS has already been scanned.
|
protected Node |
unaryNumericPromotion(Node node)
Perform unary numeric promotion on the input node.
|
protected Node |
unbox(Node node)
If the input node is a boxed type, unbox it, otherwise leave it alone.
|
protected java.lang.String |
uniqueName(java.lang.String prefix) |
Node |
visitAnnotatedType(com.sun.source.tree.AnnotatedTypeTree tree,
java.lang.Void p) |
Node |
visitAnnotation(com.sun.source.tree.AnnotationTree tree,
java.lang.Void p) |
Node |
visitArrayAccess(com.sun.source.tree.ArrayAccessTree tree,
java.lang.Void p) |
Node |
visitArrayType(com.sun.source.tree.ArrayTypeTree tree,
java.lang.Void p) |
Node |
visitAssert(com.sun.source.tree.AssertTree tree,
java.lang.Void p) |
Node |
visitAssignment(com.sun.source.tree.AssignmentTree tree,
java.lang.Void p) |
Node |
visitBinary(com.sun.source.tree.BinaryTree tree,
java.lang.Void p) |
Node |
visitBlock(com.sun.source.tree.BlockTree tree,
java.lang.Void p) |
Node |
visitBreak(com.sun.source.tree.BreakTree tree,
java.lang.Void p) |
Node |
visitCase(com.sun.source.tree.CaseTree tree,
java.lang.Void p) |
Node |
visitCatch(com.sun.source.tree.CatchTree tree,
java.lang.Void p) |
Node |
visitClass(com.sun.source.tree.ClassTree tree,
java.lang.Void p) |
Node |
visitCompilationUnit(com.sun.source.tree.CompilationUnitTree tree,
java.lang.Void p) |
Node |
visitCompoundAssignment(com.sun.source.tree.CompoundAssignmentTree tree,
java.lang.Void p) |
Node |
visitConditionalExpression(com.sun.source.tree.ConditionalExpressionTree tree,
java.lang.Void p) |
Node |
visitContinue(com.sun.source.tree.ContinueTree tree,
java.lang.Void p) |
Node |
visitDoWhileLoop(com.sun.source.tree.DoWhileLoopTree tree,
java.lang.Void p) |
Node |
visitEmptyStatement(com.sun.source.tree.EmptyStatementTree tree,
java.lang.Void p) |
Node |
visitEnhancedForLoop(com.sun.source.tree.EnhancedForLoopTree tree,
java.lang.Void p) |
Node |
visitErroneous(com.sun.source.tree.ErroneousTree tree,
java.lang.Void p) |
Node |
visitExpressionStatement(com.sun.source.tree.ExpressionStatementTree tree,
java.lang.Void p) |
Node |
visitForLoop(com.sun.source.tree.ForLoopTree tree,
java.lang.Void p) |
Node |
visitIdentifier(com.sun.source.tree.IdentifierTree tree,
java.lang.Void p) |
Node |
visitIf(com.sun.source.tree.IfTree tree,
java.lang.Void p) |
Node |
visitImport(com.sun.source.tree.ImportTree tree,
java.lang.Void p) |
Node |
visitInstanceOf(com.sun.source.tree.InstanceOfTree tree,
java.lang.Void p) |
Node |
visitLabeledStatement(com.sun.source.tree.LabeledStatementTree tree,
java.lang.Void p) |
Node |
visitLambdaExpression(com.sun.source.tree.LambdaExpressionTree tree,
java.lang.Void p) |
Node |
visitLiteral(com.sun.source.tree.LiteralTree tree,
java.lang.Void p) |
Node |
visitMemberReference(com.sun.source.tree.MemberReferenceTree tree,
java.lang.Void p) |
Node |
visitMemberSelect(com.sun.source.tree.MemberSelectTree tree,
java.lang.Void p) |
Node |
visitMethod(com.sun.source.tree.MethodTree tree,
java.lang.Void p) |
MethodInvocationNode |
visitMethodInvocation(com.sun.source.tree.MethodInvocationTree tree,
java.lang.Void p) |
Node |
visitModifiers(com.sun.source.tree.ModifiersTree tree,
java.lang.Void p) |
Node |
visitNewArray(com.sun.source.tree.NewArrayTree tree,
java.lang.Void p) |
Node |
visitNewClass(com.sun.source.tree.NewClassTree tree,
java.lang.Void p) |
Node |
visitOther(com.sun.source.tree.Tree tree,
java.lang.Void p) |
Node |
visitParameterizedType(com.sun.source.tree.ParameterizedTypeTree tree,
java.lang.Void p) |
Node |
visitParenthesized(com.sun.source.tree.ParenthesizedTree tree,
java.lang.Void p) |
Node |
visitPrimitiveType(com.sun.source.tree.PrimitiveTypeTree tree,
java.lang.Void p) |
Node |
visitReturn(com.sun.source.tree.ReturnTree tree,
java.lang.Void p) |
Node |
visitSwitch(com.sun.source.tree.SwitchTree tree,
java.lang.Void p) |
Node |
visitSynchronized(com.sun.source.tree.SynchronizedTree tree,
java.lang.Void p) |
Node |
visitThrow(com.sun.source.tree.ThrowTree tree,
java.lang.Void p) |
Node |
visitTry(com.sun.source.tree.TryTree tree,
java.lang.Void p) |
Node |
visitTypeCast(com.sun.source.tree.TypeCastTree tree,
java.lang.Void p) |
Node |
visitTypeParameter(com.sun.source.tree.TypeParameterTree tree,
java.lang.Void p) |
Node |
visitUnary(com.sun.source.tree.UnaryTree tree,
java.lang.Void p) |
Node |
visitUnionType(com.sun.source.tree.UnionTypeTree tree,
java.lang.Void p) |
Node |
visitVariable(com.sun.source.tree.VariableTree tree,
java.lang.Void p) |
Node |
visitWhileLoop(com.sun.source.tree.WhileLoopTree tree,
java.lang.Void p) |
Node |
visitWildcard(com.sun.source.tree.WildcardTree tree,
java.lang.Void p) |
protected Node |
widen(Node node,
javax.lang.model.type.TypeMirror destType)
Perform widening primitive conversion on the input node to make it match the destination
type.
|
protected com.sun.source.tree.Tree.Kind |
withoutAssignment(com.sun.source.tree.Tree.Kind kind)
Map an operation with assignment to the corresponding operation without assignment.
|
protected final javax.annotation.processing.ProcessingEnvironment env
protected final javax.lang.model.util.Elements elements
protected final javax.lang.model.util.Types types
protected final com.sun.source.util.Trees trees
protected final TreeBuilder treeBuilder
protected final AnnotationProvider annotationProvider
protected final boolean assumeAssertionsDisabled
protected final boolean assumeAssertionsEnabled
protected final CFGBuilder.Label regularExitLabel
protected final CFGBuilder.Label exceptionalExitLabel
protected @Nullable CFGBuilder.TryFinallyScopeCell returnTargetL
CFGBuilder.TryFinallyScopeCell
to which a return statement should jump, or null if
there is no valid destination.protected @Nullable CFGBuilder.TryFinallyScopeCell breakTargetL
CFGBuilder.TryFinallyScopeCell
to which a break statement with no label should jump,
or null if there is no valid destination.protected java.util.Map<javax.lang.model.element.Name,CFGBuilder.Label> breakLabels
CFGBuilder.Label
s for breaks. Each labeled statement creates
two CFG CFGBuilder.Label
s, one for break and one for continue.protected @Nullable CFGBuilder.TryFinallyScopeCell continueTargetL
CFGBuilder.TryFinallyScopeCell
to which a continue statement with no label should
jump, or null if there is no valid destination.protected java.util.Map<javax.lang.model.element.Name,CFGBuilder.Label> continueLabels
CFGBuilder.Label
s for continues. Each labeled statement
creates two CFG CFGBuilder.Label
s, one for break and one for continue.protected final java.util.IdentityHashMap<com.sun.source.tree.Tree,java.util.Set<Node>> treeLookupMap
Tree
s to sets of Node
s. Every Tree that produces a value
will have at least one corresponding Node. Trees that undergo conversions, such as boxing
or unboxing, can map to two distinct Nodes. The Node for the pre-conversion value is
stored in the treeLookupMap, while the Node for the post-conversion value is stored in
the convertedTreeLookupMap.protected final java.util.IdentityHashMap<com.sun.source.tree.Tree,java.util.Set<Node>> convertedTreeLookupMap
Tree
s to post-conversion sets of Node
s.protected final java.util.IdentityHashMap<com.sun.source.tree.UnaryTree,AssignmentNode> unaryAssignNodeLookupMap
UnaryTree
s to compound AssignmentNode
s.protected final java.util.ArrayList<CFGBuilder.ExtendedNode> nodeList
protected final java.util.Map<CFGBuilder.Label,java.lang.Integer> bindings
nodeList
.protected final java.util.Set<java.lang.Integer> leaders
nodeList
).protected final java.util.List<com.sun.source.tree.ClassTree> declaredClasses
protected final java.util.List<com.sun.source.tree.LambdaExpressionTree> declaredLambdas
protected long uid
protected com.sun.source.tree.VariableTree ea
VariableTree
that indicates whether assertions are enabled or not.public CFGTranslationPhaseOne(TreeBuilder treeBuilder, AnnotationProvider annotationProvider, boolean assumeAssertionsEnabled, boolean assumeAssertionsDisabled, javax.annotation.processing.ProcessingEnvironment env)
treeBuilder
- builder for new AST nodesannotationProvider
- extracts annotations from AST nodesassumeAssertionsDisabled
- can assertions be assumed to be disabled?assumeAssertionsEnabled
- can assertions be assumed to be enabled?env
- annotation processing environment containing type utilitiespublic CFGBuilder.PhaseOneResult process(com.sun.source.util.TreePath bodyPath, UnderlyingAST underlyingAST)
bodyPath
- path to the body of the underlying AST's methodunderlyingAST
- the AST for which the CFG is to be builtpublic CFGBuilder.PhaseOneResult process(com.sun.source.tree.CompilationUnitTree root, UnderlyingAST underlyingAST)
public void handleArtificialTree(com.sun.source.tree.Tree tree)
tree
- the newly created Treeprotected void addToLookupMap(Node node)
node
- the node to add to the lookup mapprotected void addToConvertedLookupMap(Node node)
node
- the node to add to the lookup mapprotected void addToConvertedLookupMap(com.sun.source.tree.Tree tree, Node node)
tree
- the tree used as a key in the mapnode
- the node to add to the lookup mapprotected void addToUnaryAssignLookupMap(com.sun.source.tree.UnaryTree tree, AssignmentNode unaryAssignNode)
tree
- the tree used as a key in the mapunaryAssignNode
- the node to add to the lookup mapprotected <T extends Node> T extendWithNode(T node)
node
- the node to addprotected CFGBuilder.NodeWithExceptionsHolder extendWithNodeWithException(Node node, javax.lang.model.type.TypeMirror cause)
node
might throw the
exception cause
.node
- the node to addcause
- an exception that the node might throwprotected CFGBuilder.NodeWithExceptionsHolder extendWithNodeWithExceptions(Node node, java.util.Set<javax.lang.model.type.TypeMirror> causes)
node
might throw any of the
exception in causes
.node
- the node to addcauses
- set of exceptions that the node might throwprotected <T extends Node> T insertNodeAfter(T node, Node pred)
node
after pred
in the list of extended nodes, or append to the
list if pred
is not present.node
- the node to addpred
- the desired predecessor of nodeprotected CFGBuilder.NodeWithExceptionsHolder insertNodeWithExceptionsAfter(Node node, java.util.Set<javax.lang.model.type.TypeMirror> causes, Node pred)
node
that might throw the exception cause
after pred
in
the list of extended nodes, or append to the list if pred
is not present.node
- the node to addcauses
- set of exceptions that the node might throwpred
- the desired predecessor of nodeprotected void extendWithExtendedNode(CFGBuilder.ExtendedNode n)
n
- the extended nodeprotected void insertExtendedNodeAfter(CFGBuilder.ExtendedNode n, Node pred)
n
after the node pred
in the list of extended nodes, or append
n
if pred
is not present.n
- the extended nodepred
- the desired predecessorprotected void addLabelForNextNode(CFGBuilder.Label l)
l
to the extended node that will be placed next in the sequence.protected java.lang.String uniqueName(java.lang.String prefix)
protected Node box(Node node)
node
- in input nodeprotected Node unbox(Node node)
node
- in input nodeprotected Node stringConversion(Node node)
node
- an input nodeprotected Node unaryNumericPromotion(Node node)
node
- a node producing a value of numeric primitive or boxed typeprotected boolean isNumericOrBoxed(javax.lang.model.type.TypeMirror type)
protected javax.lang.model.type.TypeMirror binaryPromotedType(javax.lang.model.type.TypeMirror left, javax.lang.model.type.TypeMirror right)
left
- the type of the left operandright
- the type of the right operandprotected Node binaryNumericPromotion(Node node, javax.lang.model.type.TypeMirror exprType)
node
- a node producing a value of numeric primitive or boxed typeexprType
- the type to promote the value toprotected Node widen(Node node, javax.lang.model.type.TypeMirror destType)
node
- a node producing a value of numeric primitive typedestType
- the type to widen the value toprotected Node narrow(Node node, javax.lang.model.type.TypeMirror destType)
node
- a node producing a value of numeric primitive typedestType
- the type to narrow the value toprotected Node narrowAndBox(Node node, javax.lang.model.type.TypeMirror destType)
node
- a node producing a value of numeric primitive typedestType
- the type to narrow the value to (possibly boxed)protected boolean conversionRequiresNarrowing(javax.lang.model.type.TypeMirror varType, Node node)
varType
- the type of a variable (or general LHS) to be converted tonode
- a node whose value is being convertedprotected Node commonConvert(Node node, javax.lang.model.type.TypeMirror varType, boolean contextAllowsNarrowing)
node
- a Node producing a valuevarType
- the type of a variablecontextAllowsNarrowing
- whether to allow narrowing (for assignment conversion) or
not (for method invocation conversion)protected Node assignConvert(Node node, javax.lang.model.type.TypeMirror varType)
node
- a Node producing a valuevarType
- the type of a variableprotected Node methodInvocationConvert(Node node, javax.lang.model.type.TypeMirror formalType)
node
- a Node producing a valueformalType
- the type of a formal parameterprotected java.util.List<Node> convertCallArguments(javax.lang.model.element.ExecutableElement method, java.util.List<? extends com.sun.source.tree.ExpressionTree> actualExprs)
Node
s representing the arguments converted for a call of the method. This method applies
to both method invocations and constructor calls.method
- an ExecutableElement representing a method to be calledactualExprs
- a List of argument expressions to a callNode
s representing arguments after conversions required by a
call to this methodprotected Node conditionalExprPromotion(Node node, javax.lang.model.type.TypeMirror destType)
node
- a node occurring as the second or third operand of a conditional expressiondestType
- the type to promote the value toprotected @Nullable javax.lang.model.element.Name getLabel(com.sun.source.util.TreePath path)
Name
of the leaf in the argument path, or null if the leaf is
not a labeled statement.public Node visitAnnotatedType(com.sun.source.tree.AnnotatedTypeTree tree, java.lang.Void p)
public Node visitAnnotation(com.sun.source.tree.AnnotationTree tree, java.lang.Void p)
public MethodInvocationNode visitMethodInvocation(com.sun.source.tree.MethodInvocationTree tree, java.lang.Void p)
public Node visitAssert(com.sun.source.tree.AssertTree tree, java.lang.Void p)
protected boolean assumeAssertionsEnabledFor(com.sun.source.tree.AssertTree tree)
AssertTree
? False by
default.protected com.sun.source.tree.VariableTree getAssertionsEnabledVariable()
VariableTree
that indicates whether assertions are enabled or
not.protected void translateAssertWithAssertionsEnabled(com.sun.source.tree.AssertTree tree)
public Node visitAssignment(com.sun.source.tree.AssignmentTree tree, java.lang.Void p)
protected AssignmentNode translateAssignment(com.sun.source.tree.Tree tree, Node target, com.sun.source.tree.ExpressionTree rhs)
protected AssignmentNode translateAssignment(com.sun.source.tree.Tree tree, Node target, Node expression)
protected com.sun.source.tree.Tree.Kind withoutAssignment(com.sun.source.tree.Tree.Kind kind)
kind
- a Tree.Kind representing an operation with assignmentpublic Node visitCompoundAssignment(com.sun.source.tree.CompoundAssignmentTree tree, java.lang.Void p)
public Node visitBinary(com.sun.source.tree.BinaryTree tree, java.lang.Void p)
public Node visitBlock(com.sun.source.tree.BlockTree tree, java.lang.Void p)
public Node visitBreak(com.sun.source.tree.BreakTree tree, java.lang.Void p)
public Node visitSwitch(com.sun.source.tree.SwitchTree tree, java.lang.Void p)
public Node visitCase(com.sun.source.tree.CaseTree tree, java.lang.Void p)
public Node visitCatch(com.sun.source.tree.CatchTree tree, java.lang.Void p)
public Node visitClass(com.sun.source.tree.ClassTree tree, java.lang.Void p)
public Node visitConditionalExpression(com.sun.source.tree.ConditionalExpressionTree tree, java.lang.Void p)
public Node visitContinue(com.sun.source.tree.ContinueTree tree, java.lang.Void p)
public Node visitDoWhileLoop(com.sun.source.tree.DoWhileLoopTree tree, java.lang.Void p)
public Node visitErroneous(com.sun.source.tree.ErroneousTree tree, java.lang.Void p)
public Node visitExpressionStatement(com.sun.source.tree.ExpressionStatementTree tree, java.lang.Void p)
public Node visitEnhancedForLoop(com.sun.source.tree.EnhancedForLoopTree tree, java.lang.Void p)
protected com.sun.source.tree.VariableTree createEnhancedForLoopIteratorVariable(com.sun.source.tree.MethodInvocationTree iteratorCall, javax.lang.model.element.VariableElement variableElement)
protected com.sun.source.tree.VariableTree createEnhancedForLoopArrayVariable(com.sun.source.tree.ExpressionTree expression, javax.lang.model.element.VariableElement variableElement)
public Node visitForLoop(com.sun.source.tree.ForLoopTree tree, java.lang.Void p)
public Node visitIdentifier(com.sun.source.tree.IdentifierTree tree, java.lang.Void p)
public Node visitIf(com.sun.source.tree.IfTree tree, java.lang.Void p)
public Node visitImport(com.sun.source.tree.ImportTree tree, java.lang.Void p)
public Node visitArrayAccess(com.sun.source.tree.ArrayAccessTree tree, java.lang.Void p)
public Node visitLabeledStatement(com.sun.source.tree.LabeledStatementTree tree, java.lang.Void p)
public Node visitLiteral(com.sun.source.tree.LiteralTree tree, java.lang.Void p)
public Node visitMethod(com.sun.source.tree.MethodTree tree, java.lang.Void p)
public Node visitModifiers(com.sun.source.tree.ModifiersTree tree, java.lang.Void p)
public Node visitNewArray(com.sun.source.tree.NewArrayTree tree, java.lang.Void p)
public Node visitNewClass(com.sun.source.tree.NewClassTree tree, java.lang.Void p)
public Node visitParenthesized(com.sun.source.tree.ParenthesizedTree tree, java.lang.Void p)
public Node visitReturn(com.sun.source.tree.ReturnTree tree, java.lang.Void p)
public Node visitMemberSelect(com.sun.source.tree.MemberSelectTree tree, java.lang.Void p)
public Node visitEmptyStatement(com.sun.source.tree.EmptyStatementTree tree, java.lang.Void p)
public Node visitSynchronized(com.sun.source.tree.SynchronizedTree tree, java.lang.Void p)
public Node visitThrow(com.sun.source.tree.ThrowTree tree, java.lang.Void p)
public Node visitCompilationUnit(com.sun.source.tree.CompilationUnitTree tree, java.lang.Void p)
public Node visitTry(com.sun.source.tree.TryTree tree, java.lang.Void p)
public Node visitParameterizedType(com.sun.source.tree.ParameterizedTypeTree tree, java.lang.Void p)
public Node visitUnionType(com.sun.source.tree.UnionTypeTree tree, java.lang.Void p)
public Node visitArrayType(com.sun.source.tree.ArrayTypeTree tree, java.lang.Void p)
public Node visitTypeCast(com.sun.source.tree.TypeCastTree tree, java.lang.Void p)
public Node visitPrimitiveType(com.sun.source.tree.PrimitiveTypeTree tree, java.lang.Void p)
public Node visitTypeParameter(com.sun.source.tree.TypeParameterTree tree, java.lang.Void p)
public Node visitInstanceOf(com.sun.source.tree.InstanceOfTree tree, java.lang.Void p)
public Node visitUnary(com.sun.source.tree.UnaryTree tree, java.lang.Void p)
public Node visitVariable(com.sun.source.tree.VariableTree tree, java.lang.Void p)
public Node visitWhileLoop(com.sun.source.tree.WhileLoopTree tree, java.lang.Void p)
public Node visitLambdaExpression(com.sun.source.tree.LambdaExpressionTree tree, java.lang.Void p)
public Node visitMemberReference(com.sun.source.tree.MemberReferenceTree tree, java.lang.Void p)
public Node visitWildcard(com.sun.source.tree.WildcardTree tree, java.lang.Void p)