Class CFGTranslationPhaseOne
- All Implemented Interfaces:
TreeVisitor<Node,Void>
- Direct Known Subclasses:
CFCFGBuilder.CFCFGTranslationPhaseOne
- A sequence of extended nodes.
- A set of bindings from
Labels to positions in the node sequence. - A set of leader nodes that give rise to basic blocks in phase two.
- A mapping from AST tree nodes to
Nodes.
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 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).
The entry point to process a single body (e.g., method, lambda, top-level block) is process(TreePath, UnderlyingAST).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classHolds the elements of anAssertMethodannotation. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AnnotationProviderThe annotation provider, e.g., a type factory.protected final TypeMirrorThe ArithmeticException type.protected final Set<TypeMirror> Exceptions that can be thrown by array access "a[i]".protected final TypeMirrorThe ArrayIndexOutOfBoundsException type.protected final TypeMirrorThe AssertionError type.protected final booleanCan assertions be assumed to be disabled?protected final booleanCan assertions be assumed to be enabled?protected final TypeMirrorThe ClassCastException type .protected final @Nullable TypeMirrorThe ClassCircularityError type.protected final @Nullable TypeMirrorThe ClassFormatErrorType type.protected VariableTreeTheVariableTreethat indicates whether assertions are enabled or not.protected final ElementsThe javac element utilities.protected final ProcessingEnvironmentAnnotation processing environment and its associated type and tree utilities.protected final TypeMirrorThe Iterable type (erased).protected final TypeMirrorThe NegativeArraySizeException type.protected final Set<TypeMirror> Exceptions that can be thrown by array creation "new SomeType[]".protected final @Nullable TypeMirrorThe NoClassDefFoundError type.protected final TypeMirrorThe NullPointerException type .protected final @Nullable TypeMirrorThe OutOfMemoryError type.protected final TypeMirrorThe String type.protected final TypeMirrorThe Throwable type.protected final TreeBuilderThe tree builder.protected final TreesThe javac tree utilities.protected final TypesThe javac type utilities.protected longThe UID for the next unique name.protected final Set<TypeMirror> Supertypes of all unchecked exceptions. -
Constructor Summary
ConstructorsConstructorDescriptionCFGTranslationPhaseOne(TreeBuilder treeBuilder, AnnotationProvider annotationProvider, boolean assumeAssertionsEnabled, boolean assumeAssertionsDisabled, ProcessingEnvironment env) CreatesCFGTranslationPhaseOne. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdd the labellto the extended node that will be placed next in the sequence.protected voidaddToConvertedLookupMap(Tree tree, Node node) Add a node in the post-conversion lookup map.protected voidaddToConvertedLookupMap(Node node) Add a node in the post-conversion lookup map.protected voidaddToLookupMap(Node node) Add a node to the lookup map if it not already present.protected NodeassignConvert(Node node, TypeMirror varType) Perform assignment conversion so that it can be assigned to a variable of the given type.protected booleanShould assertions be assumed to be executed for a givenAssertTree? False by default.protected NodebinaryNumericPromotion(Node node, TypeMirror exprType) Perform binary numeric promotion on the input node to make it match the expression type.protected TypeMirrorbinaryPromotedType(TypeMirror left, TypeMirror right) Compute the type to which two numeric types must be promoted before performing a binary numeric operation on them.protected NodeIf the input node is an unboxed primitive type, insert a call to the appropriate valueOf method, otherwise leave it alone.protected NodecommonConvert(Node node, TypeMirror varType, boolean contextAllowsNarrowing) Assignment conversion and method invocation conversion are almost identical, except that assignment conversion allows narrowing.protected NodeconditionalExprPromotion(Node node, TypeMirror destType) Convert an operand of a conditional expression to the type of the whole expression.protected booleanconversionRequiresNarrowing(TypeMirror varType, Node node) Returns true if a conversion from the type of the node to varType requires narrowing.convertCallArguments(ExpressionTree tree, ExecutableElement method, ExecutableType methodType, List<? extends ExpressionTree> actualExprs) Given a method element, its type at the call site, and a list of argument expressions, return a list ofNodes representing the arguments converted for a call of the method.protected VariableTreecreateEnhancedForLoopArrayVariable(ExpressionTree expression, VariableElement variableElement) protected VariableTreecreateEnhancedForLoopIteratorVariable(MethodInvocationTree iteratorCall, VariableElement variableElement) protected org.checkerframework.dataflow.cfg.builder.NodeWithExceptionsHolderExtend a list of extended nodes with a ClassName node.protected voidExtend the list of extended nodes with an extended node.protected voidextendWithNode(Node node) Extend the list of extended nodes with a node.protected org.checkerframework.dataflow.cfg.builder.NodeWithExceptionsHolderextendWithNodeWithException(Node node, TypeMirror cause) Extend the list of extended nodes with a node, wherenodemight throw the exceptioncause.protected org.checkerframework.dataflow.cfg.builder.NodeWithExceptionsHolderextendWithNodeWithExceptions(Node node, Set<TypeMirror> causes) Extend the list of extended nodes with a node, wherenodemight throw any of the exceptions incauses.protected VariableTreeGet a syntheticVariableTreethat indicates whether assertions are enabled or not.protected CFGTranslationPhaseOne.AssertMethodTupleReturns the AssertMethodTuple formethod.Returns the current path for the tree currently being scanned.Returns the labelNameof the leaf in the argument path, or null if the leaf is not a labeled statement.protected TypeMirrorgetTypeMirror(Class<?> clazz) Returns the TypeMirror for the given class.voidhandleArtificialTree(Tree tree) Perform any actions required when CFG translation creates a new Tree that is not part of the original AST.protected voidinsertExtendedNodeAfter(ExtendedNode n, Node pred) Insertnafter the nodepredin the list of extended nodes, or appendnifpredis not present.protected <T extends Node>
TinsertNodeAfter(T node, Node pred) Insertnodeafterpredin the list of extended nodes, or append to the list ifpredis not present.protected org.checkerframework.dataflow.cfg.builder.NodeWithExceptionsHolderinsertNodeWithExceptionsAfter(Node node, Set<TypeMirror> causes, Node pred) Insert anodethat might throw the exceptions incausesafterpredin the list of extended nodes, or append to the list ifpredis not present.protected booleanisNumericOrBoxed(TypeMirror type) Returns true if the argument type is a numeric primitive or a boxed numeric primitive and false otherwise.protected @Nullable TypeMirrormaybeGetTypeMirror(Class<?> clazz) Returns the TypeMirror for the given class, ornullif the type is not present.protected NodemethodInvocationConvert(Node node, TypeMirror formalType) Perform method invocation conversion so that the node can be passed as a formal parameter of the given type.protected Nodenarrow(Node node, TypeMirror destType) Perform narrowing conversion on the input node to make it match the destination type.protected NodenarrowAndBox(Node node, TypeMirror destType) Perform narrowing conversion and optionally boxing conversion on the input node to make it match the destination type.process(CompilationUnitTree root, UnderlyingAST underlyingAST) Process a single body withinroot.process(TreePath bodyPath, UnderlyingAST underlyingAST) Performs the actual work of phase one: processing a single body (of a method, lambda, top-level block, etc.).protected NodestringConversion(Node node) Convert the input node to String type, if it isn't already.protected voidTranslates an assertion statement to the correct CFG nodes.protected AssignmentNodetranslateAssignment(Tree tree, Node target, ExpressionTree rhs) Translate an assignment.protected AssignmentNodetranslateAssignment(Tree tree, Node target, Node expression) Translate an assignment where the RHS has already been scanned.protected voidtreatMethodAsAssert(MethodInvocationTree tree, CFGTranslationPhaseOne.AssertMethodTuple assertMethodTuple, Node condition) Translates a method marked asAssertMethodinto CFG nodes corresponding to anassertstatement.protected NodeunaryNumericPromotion(Node node) Perform unary numeric promotion on the input node.protected NodeIf the input node is a boxed type, unbox it, otherwise leave it alone.protected StringuniqueName(String prefix) Returns a unique name starting withprefix.visitAnnotatedType(AnnotatedTypeTree tree, Void p) visitAnnotation(AnnotationTree tree, Void p) visitArrayAccess(ArrayAccessTree tree, Void p) visitArrayType(ArrayTypeTree tree, Void p) visitAssert(AssertTree tree, Void p) visitAssignment(AssignmentTree tree, Void p) visitBinary(BinaryTree tree, Void p) visitBindingPattern17(Tree bindingPatternTree, Void p) Visit a BindingPatternTree.visitBlock(BlockTree tree, Void p) visitBreak(BreakTree tree, Void p) visitCatch(CatchTree tree, Void p) visitClass(ClassTree tree, Void p) visitCompilationUnit(CompilationUnitTree tree, Void p) visitContinue(ContinueTree tree, Void p) visitDeconstructionPattern21(Tree deconstructionPatternTree, Void p) Visit a DeconstructionPatternTree.visitDoWhileLoop(DoWhileLoopTree tree, Void p) visitEmptyStatement(EmptyStatementTree tree, Void p) visitEnhancedForLoop(EnhancedForLoopTree tree, Void p) visitErroneous(ErroneousTree tree, Void p) visitForLoop(ForLoopTree tree, Void p) visitIdentifier(IdentifierTree tree, Void p) visitImport(ImportTree tree, Void p) visitInstanceOf(InstanceOfTree tree, Void p) visitLiteral(LiteralTree tree, Void p) visitMemberReference(MemberReferenceTree tree, Void p) visitMemberSelect(MemberSelectTree tree, Void p) visitMethod(MethodTree tree, Void p) visitModifiers(ModifiersTree tree, Void p) visitNewArray(NewArrayTree tree, Void p) visitNewClass(NewClassTree tree, Void p) visitOther(Tree tree, Void p) visitParenthesized(ParenthesizedTree tree, Void p) visitPrimitiveType(PrimitiveTypeTree tree, Void p) visitReturn(ReturnTree tree, Void p) visitSwitch(SwitchTree tree, Void p) visitSwitchExpression17(Tree switchExpressionTree, Void p) Visit a SwitchExpressionTree.visitSynchronized(SynchronizedTree tree, Void p) visitThrow(ThrowTree tree, Void p) visitTypeCast(TypeCastTree tree, Void p) visitTypeParameter(TypeParameterTree tree, Void p) visitUnary(UnaryTree tree, Void p) visitUnionType(UnionTypeTree tree, Void p) visitVariable(VariableTree tree, Void p) visitWhileLoop(WhileLoopTree tree, Void p) visitWildcard(WildcardTree tree, Void p) visitYield17(Tree yieldTree, Void p) Visit a SwitchExpressionTree.protected Nodewiden(Node node, TypeMirror destType) Perform widening primitive conversion on the input node to make it match the destination type.protected Tree.KindwithoutAssignment(Tree.Kind kind) Map an operation with assignment to the corresponding operation without assignment.Methods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitAnyPattern, visitBindingPattern, visitConstantCaseLabel, visitDeconstructionPattern, visitDefaultCaseLabel, visitExports, visitIntersectionType, visitModule, visitOpens, visitPackage, visitPatternCaseLabel, visitProvides, visitRequires, visitStringTemplate, visitSwitchExpression, visitUses, visitYield
-
Field Details
-
env
Annotation processing environment and its associated type and tree utilities. -
elements
The javac element utilities. -
types
The javac type utilities. -
trees
The javac tree utilities. -
treeBuilder
The tree builder. -
annotationProvider
The annotation provider, e.g., a type factory. -
assumeAssertionsDisabled
protected final boolean assumeAssertionsDisabledCan assertions be assumed to be disabled? -
assumeAssertionsEnabled
protected final boolean assumeAssertionsEnabledCan assertions be assumed to be enabled? -
arithmeticExceptionType
The ArithmeticException type. -
arrayIndexOutOfBoundsExceptionType
The ArrayIndexOutOfBoundsException type. -
assertionErrorType
The AssertionError type. -
classCastExceptionType
The ClassCastException type . -
iterableType
The Iterable type (erased). -
negativeArraySizeExceptionType
The NegativeArraySizeException type. -
nullPointerExceptionType
The NullPointerException type . -
outOfMemoryErrorType
The OutOfMemoryError type. -
classCircularityErrorType
The ClassCircularityError type. -
classFormatErrorType
The ClassFormatErrorType type. -
noClassDefFoundErrorType
The NoClassDefFoundError type. -
stringType
The String type. -
throwableType
The Throwable type. -
uncheckedExceptionTypes
Supertypes of all unchecked exceptions. The size is 2 and the contents areRuntimeExceptionandError. -
newArrayExceptionTypes
Exceptions that can be thrown by array creation "new SomeType[]". The size is 2 and the contents areNegativeArraySizeExceptionandOutOfMemoryError. This list comes from JLS 15.10.1 "Run-Time Evaluation of Array Creation Expressions". -
arrayAccessExceptionTypes
Exceptions that can be thrown by array access "a[i]". The size is 2 and the contents areArrayIndexOutOfBoundsExceptionandNullPointerException. -
uid
protected long uidThe UID for the next unique name. -
ea
TheVariableTreethat indicates whether assertions are enabled or not.
-
-
Constructor Details
-
CFGTranslationPhaseOne
public CFGTranslationPhaseOne(TreeBuilder treeBuilder, AnnotationProvider annotationProvider, boolean assumeAssertionsEnabled, boolean assumeAssertionsDisabled, ProcessingEnvironment env) CreatesCFGTranslationPhaseOne.- Parameters:
treeBuilder- builder for new AST nodesannotationProvider- extracts annotations from AST nodesassumeAssertionsEnabled- can assertions be assumed to be enabled?assumeAssertionsDisabled- can assertions be assumed to be disabled?env- annotation processing environment containing type utilities
-
-
Method Details
-
process
Performs the actual work of phase one: processing a single body (of a method, lambda, top-level block, etc.).- Parameters:
bodyPath- path to the body of the underlying AST's methodunderlyingAST- the AST for which the CFG is to be built- Returns:
- the result of phase one
-
process
Process a single body withinroot. This method does not process the entire given CompilationUnitTree. Rather, it processes one body (of a method/lambda/etc.) within it, which corresponds tounderlyingAST.- Parameters:
root- the compilation unitunderlyingAST- the AST corresponding to the body to process- Returns:
- a PhaseOneResult
-
handleArtificialTree
Perform any actions required when CFG translation creates a new Tree that is not part of the original AST.- Parameters:
tree- the newly created Tree
-
getCurrentPath
Returns the current path for the tree currently being scanned.- Returns:
- the current path
-
scan
- Overrides:
scanin classTreeScanner<Node,Void>
-
visitYield17
Visit a SwitchExpressionTree.- Parameters:
yieldTree- a YieldTree, typed as Tree to be backward-compatiblep- parameter- Returns:
- the result of visiting the switch expression tree
-
visitSwitchExpression17
Visit a SwitchExpressionTree.- Parameters:
switchExpressionTree- a SwitchExpressionTree, typed as Tree to be backward-compatiblep- parameter- Returns:
- the result of visiting the switch expression tree
-
visitBindingPattern17
Visit a BindingPatternTree.- Parameters:
bindingPatternTree- a BindingPatternTree, typed as Tree to be backward-compatiblep- parameter- Returns:
- the result of visiting the binding pattern tree
-
visitDeconstructionPattern21
Visit a DeconstructionPatternTree.- Parameters:
deconstructionPatternTree- a DeconstructionPatternTree, typed as Tree so the Checker Framework compiles under JDK 20 and earlierp- an unused parameter- Returns:
- the result of visiting the tree
-
addToLookupMap
Add a node to the lookup map if it not already present.- Parameters:
node- the node to add to the lookup map
-
addToConvertedLookupMap
Add a node in the post-conversion lookup map. The node should refer to a Tree and that Tree should already be in the pre-conversion lookup map. This method is used to update the Tree-Node mapping with conversion nodes.- Parameters:
node- the node to add to the lookup map
-
addToConvertedLookupMap
Add a node in the post-conversion lookup map. The tree argument should already be in the pre-conversion lookup map. This method is used to update the Tree-Node mapping with conversion nodes.- Parameters:
tree- the tree used as a key in the mapnode- the node to add to the lookup map
-
extendWithNode
Extend the list of extended nodes with a node.- Parameters:
node- the node to add
-
extendWithNodeWithException
protected org.checkerframework.dataflow.cfg.builder.NodeWithExceptionsHolder extendWithNodeWithException(Node node, TypeMirror cause) Extend the list of extended nodes with a node, wherenodemight throw the exceptioncause.- Parameters:
node- the node to addcause- an exception that the node might throw- Returns:
- the node holder
-
extendWithNodeWithExceptions
protected org.checkerframework.dataflow.cfg.builder.NodeWithExceptionsHolder extendWithNodeWithExceptions(Node node, Set<TypeMirror> causes) Extend the list of extended nodes with a node, wherenodemight throw any of the exceptions incauses.- Parameters:
node- the node to addcauses- the set of exceptions that the node might throw- Returns:
- the node holder
-
extendWithClassNameNode
protected org.checkerframework.dataflow.cfg.builder.NodeWithExceptionsHolder extendWithClassNameNode(ClassNameNode node) Extend a list of extended nodes with a ClassName node.Evaluating a class literal kicks off class loading (JLS 15.8.2) which can fail and throw one of the specified subclasses of a LinkageError or an OutOfMemoryError (JLS 12.2.1).
- Parameters:
node- the ClassName node to add- Returns:
- the node holder
-
insertNodeAfter
Insertnodeafterpredin the list of extended nodes, or append to the list ifpredis not present.- Parameters:
node- the node to addpred- the desired predecessor of node- Returns:
- the node holder
-
insertNodeWithExceptionsAfter
protected org.checkerframework.dataflow.cfg.builder.NodeWithExceptionsHolder insertNodeWithExceptionsAfter(Node node, Set<TypeMirror> causes, Node pred) Insert anodethat might throw the exceptions incausesafterpredin the list of extended nodes, or append to the list ifpredis not present.- Parameters:
node- the node to addcauses- the set of exceptions that the node might throwpred- the desired predecessor of node- Returns:
- the node holder
-
extendWithExtendedNode
Extend the list of extended nodes with an extended node.- Parameters:
n- the extended node
-
insertExtendedNodeAfter
Insertnafter the nodepredin the list of extended nodes, or appendnifpredis not present.- Parameters:
n- the extended nodepred- the desired predecessor
-
addLabelForNextNode
Add the labellto the extended node that will be placed next in the sequence.- Parameters:
l- the node to add to the forthcoming extended node
-
uniqueName
Returns a unique name starting withprefix.- Parameters:
prefix- the prefix of the unique name- Returns:
- a unique name starting with
prefix
-
box
If the input node is an unboxed primitive type, insert a call to the appropriate valueOf method, otherwise leave it alone.- Parameters:
node- in input node- Returns:
- a Node representing the boxed version of the input, which may simply be the input node
-
unbox
If the input node is a boxed type, unbox it, otherwise leave it alone.- Parameters:
node- in input node- Returns:
- a Node representing the unboxed version of the input, which may simply be the input node
-
stringConversion
Convert the input node to String type, if it isn't already.- Parameters:
node- an input node- Returns:
- a Node with the value promoted to String, which may be the input node
-
unaryNumericPromotion
Perform unary numeric promotion on the input node.- Parameters:
node- a node producing a value of numeric primitive or boxed type- Returns:
- a Node with the value promoted to the int, long, float, or double; may return be the input node
-
isNumericOrBoxed
Returns true if the argument type is a numeric primitive or a boxed numeric primitive and false otherwise. -
binaryPromotedType
Compute the type to which two numeric types must be promoted before performing a binary numeric operation on them. The input types must both be numeric and the output type is primitive.- Parameters:
left- the type of the left operandright- the type of the right operand- Returns:
- a TypeMirror representing the binary numeric promoted type
-
binaryNumericPromotion
Perform binary numeric promotion on the input node to make it match the expression type.- Parameters:
node- a node producing a value of numeric primitive or boxed typeexprType- the type to promote the value to- Returns:
- a Node with the value promoted to the exprType, which may be the input node
-
widen
Perform widening primitive conversion on the input node to make it match the destination type.- Parameters:
node- a node producing a value of numeric primitive typedestType- the type to widen the value to- Returns:
- a Node with the value widened to the exprType, which may be the input node
-
narrow
Perform narrowing conversion on the input node to make it match the destination type.- Parameters:
node- a node producing a value of numeric primitive typedestType- the type to narrow the value to- Returns:
- a Node with the value narrowed to the exprType, which may be the input node
-
narrowAndBox
Perform narrowing conversion and optionally boxing conversion on the input node to make it match the destination type.- Parameters:
node- a node producing a value of numeric primitive typedestType- the type to narrow the value to (possibly boxed)- Returns:
- a Node with the value narrowed and boxed to the destType, which may be the input node
-
conversionRequiresNarrowing
Returns true if a conversion from the type of the node to varType requires narrowing.- Parameters:
varType- the type of a variable (or general LHS) to be converted tonode- a node whose value is being converted- Returns:
- true if this conversion requires narrowing to succeed
-
commonConvert
Assignment conversion and method invocation conversion are almost identical, except that assignment conversion allows narrowing. We factor out the common logic here.- Parameters:
node- a Node producing a valuevarType- the type of a variablecontextAllowsNarrowing- if true, allow narrowing (for assignment conversion) (for method invocation conversion)- Returns:
- a Node with the value converted to the type of the variable, which may be the input node itself
-
assignConvert
Perform assignment conversion so that it can be assigned to a variable of the given type.- Parameters:
node- a Node producing a valuevarType- the type of a variable- Returns:
- a Node with the value converted to the type of the variable, which may be the input node itself
-
methodInvocationConvert
Perform method invocation conversion so that the node can be passed as a formal parameter of the given type.- Parameters:
node- a Node producing a valueformalType- the type of a formal parameter- Returns:
- a Node with the value converted to the type of the formal, which may be the input node itself
-
convertCallArguments
protected List<Node> convertCallArguments(ExpressionTree tree, ExecutableElement method, ExecutableType methodType, List<? extends ExpressionTree> actualExprs) Given a method element, its type at the call site, and a list of argument expressions, return a list ofNodes representing the arguments converted for a call of the method. This method applies to both method invocations and constructor calls.- Parameters:
tree- the invocation tree for the callmethod- an ExecutableElement representing a method to be calledmethodType- an ExecutableType representing the type of the method call; the type must be viewpoint-adapted to the callactualExprs- a List of argument expressions to a call- Returns:
- a List of
Nodes representing arguments after conversions required by a call to this method
-
getAssertMethodTuple
Returns the AssertMethodTuple formethod. Ifmethodis not an assert method, thenCFGTranslationPhaseOne.AssertMethodTuple.NONEis returned.- Parameters:
method- a method element that might be an assert method- Returns:
- the AssertMethodTuple for
method
-
conditionalExprPromotion
Convert an operand of a conditional expression to the type of the whole expression.- Parameters:
node- a node occurring as the second or third operand of a conditional expressiondestType- the type to promote the value to- Returns:
- a Node with the value promoted to the destType, which may be the input node
-
getLabel
Returns the labelNameof the leaf in the argument path, or null if the leaf is not a labeled statement. -
visitAnnotatedType
- Specified by:
visitAnnotatedTypein interfaceTreeVisitor<Node,Void> - Overrides:
visitAnnotatedTypein classTreeScanner<Node,Void>
-
visitAnnotation
- Specified by:
visitAnnotationin interfaceTreeVisitor<Node,Void> - Overrides:
visitAnnotationin classTreeScanner<Node,Void>
-
visitMethodInvocation
- Specified by:
visitMethodInvocationin interfaceTreeVisitor<Node,Void> - Overrides:
visitMethodInvocationin classTreeScanner<Node,Void>
-
visitAssert
- Specified by:
visitAssertin interfaceTreeVisitor<Node,Void> - Overrides:
visitAssertin classTreeScanner<Node,Void>
-
assumeAssertionsEnabledFor
Should assertions be assumed to be executed for a givenAssertTree? False by default. -
getAssertionsEnabledVariable
Get a syntheticVariableTreethat indicates whether assertions are enabled or not. -
translateAssertWithAssertionsEnabled
Translates an assertion statement to the correct CFG nodes. The translation assumes that assertions are enabled. -
treatMethodAsAssert
protected void treatMethodAsAssert(MethodInvocationTree tree, CFGTranslationPhaseOne.AssertMethodTuple assertMethodTuple, Node condition) Translates a method marked asAssertMethodinto CFG nodes corresponding to anassertstatement.- Parameters:
tree- the method invocation tree for a method marked asAssertMethodassertMethodTuple- the assert method tuple for the methodcondition- the boolean expression node for the argument that the method tests
-
visitAssignment
- Specified by:
visitAssignmentin interfaceTreeVisitor<Node,Void> - Overrides:
visitAssignmentin classTreeScanner<Node,Void>
-
translateAssignment
Translate an assignment. -
translateAssignment
Translate an assignment where the RHS has already been scanned. -
withoutAssignment
Map an operation with assignment to the corresponding operation without assignment.- Parameters:
kind- a Tree.Kind representing an operation with assignment- Returns:
- the Tree.Kind for the same operation without assignment
-
visitCompoundAssignment
- Specified by:
visitCompoundAssignmentin interfaceTreeVisitor<Node,Void> - Overrides:
visitCompoundAssignmentin classTreeScanner<Node,Void>
-
visitBinary
- Specified by:
visitBinaryin interfaceTreeVisitor<Node,Void> - Overrides:
visitBinaryin classTreeScanner<Node,Void>
-
visitBlock
- Specified by:
visitBlockin interfaceTreeVisitor<Node,Void> - Overrides:
visitBlockin classTreeScanner<Node,Void>
-
visitBreak
- Specified by:
visitBreakin interfaceTreeVisitor<Node,Void> - Overrides:
visitBreakin classTreeScanner<Node,Void>
-
visitSwitch
- Specified by:
visitSwitchin interfaceTreeVisitor<Node,Void> - Overrides:
visitSwitchin classTreeScanner<Node,Void>
-
visitCase
- Specified by:
visitCasein interfaceTreeVisitor<Node,Void> - Overrides:
visitCasein classTreeScanner<Node,Void>
-
visitCatch
- Specified by:
visitCatchin interfaceTreeVisitor<Node,Void> - Overrides:
visitCatchin classTreeScanner<Node,Void>
-
visitClass
- Specified by:
visitClassin interfaceTreeVisitor<Node,Void> - Overrides:
visitClassin classTreeScanner<Node,Void>
-
visitConditionalExpression
- Specified by:
visitConditionalExpressionin interfaceTreeVisitor<Node,Void> - Overrides:
visitConditionalExpressionin classTreeScanner<Node,Void>
-
visitContinue
- Specified by:
visitContinuein interfaceTreeVisitor<Node,Void> - Overrides:
visitContinuein classTreeScanner<Node,Void>
-
visitDoWhileLoop
- Specified by:
visitDoWhileLoopin interfaceTreeVisitor<Node,Void> - Overrides:
visitDoWhileLoopin classTreeScanner<Node,Void>
-
visitErroneous
- Specified by:
visitErroneousin interfaceTreeVisitor<Node,Void> - Overrides:
visitErroneousin classTreeScanner<Node,Void>
-
visitExpressionStatement
- Specified by:
visitExpressionStatementin interfaceTreeVisitor<Node,Void> - Overrides:
visitExpressionStatementin classTreeScanner<Node,Void>
-
visitEnhancedForLoop
- Specified by:
visitEnhancedForLoopin interfaceTreeVisitor<Node,Void> - Overrides:
visitEnhancedForLoopin classTreeScanner<Node,Void>
-
createEnhancedForLoopIteratorVariable
protected VariableTree createEnhancedForLoopIteratorVariable(MethodInvocationTree iteratorCall, VariableElement variableElement) -
createEnhancedForLoopArrayVariable
protected VariableTree createEnhancedForLoopArrayVariable(ExpressionTree expression, VariableElement variableElement) -
visitForLoop
- Specified by:
visitForLoopin interfaceTreeVisitor<Node,Void> - Overrides:
visitForLoopin classTreeScanner<Node,Void>
-
visitIdentifier
- Specified by:
visitIdentifierin interfaceTreeVisitor<Node,Void> - Overrides:
visitIdentifierin classTreeScanner<Node,Void>
-
visitIf
- Specified by:
visitIfin interfaceTreeVisitor<Node,Void> - Overrides:
visitIfin classTreeScanner<Node,Void>
-
visitImport
- Specified by:
visitImportin interfaceTreeVisitor<Node,Void> - Overrides:
visitImportin classTreeScanner<Node,Void>
-
visitArrayAccess
- Specified by:
visitArrayAccessin interfaceTreeVisitor<Node,Void> - Overrides:
visitArrayAccessin classTreeScanner<Node,Void>
-
visitLabeledStatement
- Specified by:
visitLabeledStatementin interfaceTreeVisitor<Node,Void> - Overrides:
visitLabeledStatementin classTreeScanner<Node,Void>
-
visitLiteral
- Specified by:
visitLiteralin interfaceTreeVisitor<Node,Void> - Overrides:
visitLiteralin classTreeScanner<Node,Void>
-
visitMethod
- Specified by:
visitMethodin interfaceTreeVisitor<Node,Void> - Overrides:
visitMethodin classTreeScanner<Node,Void>
-
visitModifiers
- Specified by:
visitModifiersin interfaceTreeVisitor<Node,Void> - Overrides:
visitModifiersin classTreeScanner<Node,Void>
-
visitNewArray
- Specified by:
visitNewArrayin interfaceTreeVisitor<Node,Void> - Overrides:
visitNewArrayin classTreeScanner<Node,Void>
-
visitNewClass
- Specified by:
visitNewClassin interfaceTreeVisitor<Node,Void> - Overrides:
visitNewClassin classTreeScanner<Node,Void>
-
visitParenthesized
- Specified by:
visitParenthesizedin interfaceTreeVisitor<Node,Void> - Overrides:
visitParenthesizedin classTreeScanner<Node,Void>
-
visitReturn
- Specified by:
visitReturnin interfaceTreeVisitor<Node,Void> - Overrides:
visitReturnin classTreeScanner<Node,Void>
-
visitMemberSelect
- Specified by:
visitMemberSelectin interfaceTreeVisitor<Node,Void> - Overrides:
visitMemberSelectin classTreeScanner<Node,Void>
-
visitEmptyStatement
- Specified by:
visitEmptyStatementin interfaceTreeVisitor<Node,Void> - Overrides:
visitEmptyStatementin classTreeScanner<Node,Void>
-
visitSynchronized
- Specified by:
visitSynchronizedin interfaceTreeVisitor<Node,Void> - Overrides:
visitSynchronizedin classTreeScanner<Node,Void>
-
visitThrow
- Specified by:
visitThrowin interfaceTreeVisitor<Node,Void> - Overrides:
visitThrowin classTreeScanner<Node,Void>
-
visitCompilationUnit
- Specified by:
visitCompilationUnitin interfaceTreeVisitor<Node,Void> - Overrides:
visitCompilationUnitin classTreeScanner<Node,Void>
-
visitTry
- Specified by:
visitTryin interfaceTreeVisitor<Node,Void> - Overrides:
visitTryin classTreeScanner<Node,Void>
-
visitParameterizedType
- Specified by:
visitParameterizedTypein interfaceTreeVisitor<Node,Void> - Overrides:
visitParameterizedTypein classTreeScanner<Node,Void>
-
visitUnionType
- Specified by:
visitUnionTypein interfaceTreeVisitor<Node,Void> - Overrides:
visitUnionTypein classTreeScanner<Node,Void>
-
visitArrayType
- Specified by:
visitArrayTypein interfaceTreeVisitor<Node,Void> - Overrides:
visitArrayTypein classTreeScanner<Node,Void>
-
visitTypeCast
- Specified by:
visitTypeCastin interfaceTreeVisitor<Node,Void> - Overrides:
visitTypeCastin classTreeScanner<Node,Void>
-
visitPrimitiveType
- Specified by:
visitPrimitiveTypein interfaceTreeVisitor<Node,Void> - Overrides:
visitPrimitiveTypein classTreeScanner<Node,Void>
-
visitTypeParameter
- Specified by:
visitTypeParameterin interfaceTreeVisitor<Node,Void> - Overrides:
visitTypeParameterin classTreeScanner<Node,Void>
-
visitInstanceOf
- Specified by:
visitInstanceOfin interfaceTreeVisitor<Node,Void> - Overrides:
visitInstanceOfin classTreeScanner<Node,Void>
-
visitUnary
- Specified by:
visitUnaryin interfaceTreeVisitor<Node,Void> - Overrides:
visitUnaryin classTreeScanner<Node,Void>
-
visitVariable
- Specified by:
visitVariablein interfaceTreeVisitor<Node,Void> - Overrides:
visitVariablein classTreeScanner<Node,Void>
-
visitWhileLoop
- Specified by:
visitWhileLoopin interfaceTreeVisitor<Node,Void> - Overrides:
visitWhileLoopin classTreeScanner<Node,Void>
-
visitLambdaExpression
- Specified by:
visitLambdaExpressionin interfaceTreeVisitor<Node,Void> - Overrides:
visitLambdaExpressionin classTreeScanner<Node,Void>
-
visitMemberReference
- Specified by:
visitMemberReferencein interfaceTreeVisitor<Node,Void> - Overrides:
visitMemberReferencein classTreeScanner<Node,Void>
-
visitWildcard
- Specified by:
visitWildcardin interfaceTreeVisitor<Node,Void> - Overrides:
visitWildcardin classTreeScanner<Node,Void>
-
visitOther
- Specified by:
visitOtherin interfaceTreeVisitor<Node,Void> - Overrides:
visitOtherin classTreeScanner<Node,Void>
-
getTypeMirror
Returns the TypeMirror for the given class.- Parameters:
clazz- a class- Returns:
- the TypeMirror for the class
-
maybeGetTypeMirror
Returns the TypeMirror for the given class, ornullif the type is not present.This can be used to handle system types that are not present. For example, in Java code that is translated to JavaScript using j2cl, the custom bootclasspath contains APIs that are emulated in JavaScript, so some types such as OutOfMemoryError are deliberately not present.
- Parameters:
clazz- a class, which must have a canonical name- Returns:
- the TypeMirror for the class, or
nullif the type is not present
-