Class MethodInvocationNode
java.lang.Object
org.checkerframework.dataflow.cfg.node.Node
org.checkerframework.dataflow.cfg.node.MethodInvocationNode
- All Implemented Interfaces:
org.plumelib.util.UniqueId
A node for method invocation.
target(arg1, arg2, ...)CFGs can contain
MethodInvocationNodes that correspond to no AST Tree, in which
case, the tree field will be null.-
Field Summary
FieldsModifier and TypeFieldDescriptionThe arguments of the method invocation.protected @Nullable EnhancedForLoopTreeIf this MethodInvocationNode is a node for anIterator.next()desugared from an enhanced for loop, then theenhancedForLoopfield is theEnhancedForLoopTreeAST node.protected @Nullable ExpressionTreeIf this MethodInvocationNode is a node for anIterator.next()desugared from an enhanced for loop, then theiterExpressionfield is the expression in the for loop, e.g.,iterinfor(Object o: iter).protected final MethodAccessNodeThe MethodAccessNode for the method being invoked.protected final @Nullable MethodInvocationTreeThe tree for the method invocation.protected final TreePathThe tree path to the method invocation.Fields inherited from class org.checkerframework.dataflow.cfg.node.Node
block, disambiguateOwner, inSource, isLoopCondition, lvalue, type -
Constructor Summary
ConstructorsConstructorDescriptionMethodInvocationNode(@Nullable MethodInvocationTree tree, MethodAccessNode target, List<Node> arguments, TreePath treePath) Creates a MethodInvocationNode.MethodInvocationNode(MethodAccessNode target, List<Node> arguments, TreePath treePath) -
Method Summary
Modifier and TypeMethodDescription<R,P> R accept(NodeVisitor<R, P> visitor, P p) Accept method of the visitor pattern.booleangetArgument(int i) If this MethodInvocationNode is a node for anIterator.next()desugared from an enhanced for loop, then returns the correspondingEnhancedForLoopTreeAST node.If this MethodInvocationNode is a node for anIterator.next()desugared from an enhanced for loop, then returns the expression in the for loop, e.g.,iterinfor(Object o: iter).getTree()Returns theTreein the abstract syntax tree, ornullif no corresponding tree exists.Returns the tree path to the method invocation.inthashCode()voidsetEnhancedForLoop(@Nullable EnhancedForLoopTree enhancedForLoop) Sets the enhanced for loop for whichthisis the desugared loop update.voidsetIterableExpression(@Nullable ExpressionTree iterableExpression) Sets the iterable expression from a for loop.toString()Methods inherited from class org.checkerframework.dataflow.cfg.node.Node
getBlock, getInSource, getIsLoopCondition, getTransitiveOperands, getType, getUid, isLValue, nodeCollectionToString, setBlock, setInSource, setIsLoopCondition, setLValue, toStringDebugMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.plumelib.util.UniqueId
getClassAndUid
-
Field Details
-
tree
The tree for the method invocation. -
target
The MethodAccessNode for the method being invoked. Includes the receiver if any. For a static method, the receiver might be a class name. -
arguments
The arguments of the method invocation. -
treePath
The tree path to the method invocation. For an invocation that is not in the source code (seeNode.getInSource()), such as the invocation ofiterator()that an enhanced for loop desugars to, the path to a tree in the source code that is or contains the construct that the invocation implements, such as the enhanced for loop. -
iterableExpression
If this MethodInvocationNode is a node for anIterator.next()desugared from an enhanced for loop, then theiterExpressionfield is the expression in the for loop, e.g.,iterinfor(Object o: iter).Is set by
setIterableExpression(com.sun.source.tree.ExpressionTree). -
enhancedForLoop
If this MethodInvocationNode is a node for anIterator.next()desugared from an enhanced for loop, then theenhancedForLoopfield is theEnhancedForLoopTreeAST node.Is set by
setEnhancedForLoop(com.sun.source.tree.EnhancedForLoopTree).
-
-
Constructor Details
-
MethodInvocationNode
public MethodInvocationNode(@Nullable MethodInvocationTree tree, MethodAccessNode target, List<Node> arguments, TreePath treePath) Creates a MethodInvocationNode.- Parameters:
tree- the tree for the method invocationtarget- the MethodAccessNode for the method being invokedarguments- arguments of the method invocationtreePath- path to the method invocation; seegetTreePath()
-
MethodInvocationNode
-
-
Method Details
-
getTarget
-
getArguments
-
getArgument
-
getTreePath
Returns the tree path to the method invocation. For an invocation that is not in the source code (seeNode.getInSource()), such as the invocation ofiterator()that an enhanced for loop desugars to, the path to a tree in the source code that is or contains the construct that the invocation implements, such as the enhanced for loop.- Returns:
- the tree path to the method invocation
-
getIterableExpression
If this MethodInvocationNode is a node for anIterator.next()desugared from an enhanced for loop, then returns the expression in the for loop, e.g.,iterinfor(Object o: iter). Otherwise, returns null.- Returns:
- the iter expression, or null if this is not an
Iterator.next()from an enhanced for loop
-
getEnhancedForLoop
If this MethodInvocationNode is a node for anIterator.next()desugared from an enhanced for loop, then returns the correspondingEnhancedForLoopTreeAST node. Otherwise, returns null.- Returns:
- the
EnhancedForLoopTree, or null if this is not anIterator.next()from an enhanced for loop
-
setIterableExpression
Sets the iterable expression from a for loop.- Parameters:
iterableExpression- iterable expression- See Also:
-
setEnhancedForLoop
Sets the enhanced for loop for whichthisis the desugared loop update.- Parameters:
enhancedForLoop- theEnhancedForLoopTree- See Also:
-
getTree
Description copied from class:NodeReturns theTreein the abstract syntax tree, ornullif no corresponding tree exists. For instance, this is the case for anImplicitThisNode. -
accept
Description copied from class:NodeAccept method of the visitor pattern. -
toString
-
equals
-
hashCode
public int hashCode() -
getOperands
Description copied from class:Node- Specified by:
getOperandsin classNode- Returns:
- a collection containing all of the operand
Nodes of thisNode
-