Class MethodInvocationNode
- java.lang.Object
-
- org.checkerframework.dataflow.cfg.node.Node
-
- org.checkerframework.dataflow.cfg.node.MethodInvocationNode
-
- All Implemented Interfaces:
org.plumelib.util.UniqueId
public class MethodInvocationNode extends Node
A node for method invocation.target(arg1, arg2, ...)
CFGs may containMethodInvocationNode
s that correspond to no ASTTree
, in which case, the tree field will be null.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<Node>
arguments
The arguments of the method invocation.protected @Nullable com.sun.source.tree.ExpressionTree
iterableExpression
If this MethodInvocationNode is a node for anIterator.next()
desugared from an enhanced for loop, then theiterExpression
field is the expression in the for loop, e.g.,iter
infor(Object o: iter
.protected MethodAccessNode
target
The MethodAccessNode for the method being invoked.protected @Nullable com.sun.source.tree.MethodInvocationTree
tree
The tree for the method invocation.protected com.sun.source.util.TreePath
treePath
The tree path to the method invocation.
-
Constructor Summary
Constructors Constructor Description MethodInvocationNode(@Nullable com.sun.source.tree.MethodInvocationTree tree, MethodAccessNode target, java.util.List<Node> arguments, com.sun.source.util.TreePath treePath)
Create a MethodInvocationNode.MethodInvocationNode(MethodAccessNode target, java.util.List<Node> arguments, com.sun.source.util.TreePath treePath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <R,P>
Raccept(NodeVisitor<R,P> visitor, P p)
Accept method of the visitor pattern.boolean
equals(@Nullable java.lang.Object obj)
Node
getArgument(int i)
java.util.List<Node>
getArguments()
@Nullable com.sun.source.tree.ExpressionTree
getIterableExpression()
If this MethodInvocationNode is a node for anIterator.next()
desugared from an enhanced for loop, then return the expression in the for loop, e.g.,iter
infor(Object o: iter
.java.util.Collection<Node>
getOperands()
MethodAccessNode
getTarget()
@Nullable com.sun.source.tree.MethodInvocationTree
getTree()
Returns theTree
in the abstract syntax tree, ornull
if no corresponding tree exists.com.sun.source.util.TreePath
getTreePath()
int
hashCode()
void
setIterableExpression(@Nullable com.sun.source.tree.ExpressionTree iterableExpression)
Set the iterable expression from a for loop.java.lang.String
toString()
-
Methods inherited from class org.checkerframework.dataflow.cfg.node.Node
getBlock, getInSource, getTransitiveOperands, getType, getUid, isLValue, nodeCollectionToString, setBlock, setInSource, setLValue, toStringDebug
-
-
-
-
Field Detail
-
tree
protected final @Nullable com.sun.source.tree.MethodInvocationTree tree
The tree for the method invocation.
-
target
protected final MethodAccessNode target
The MethodAccessNode for the method being invoked. Includes the receiver if any. For a static method, the receiver may be a class name.
-
arguments
protected final java.util.List<Node> arguments
The arguments of the method invocation.
-
treePath
protected final com.sun.source.util.TreePath treePath
The tree path to the method invocation.
-
iterableExpression
protected @Nullable com.sun.source.tree.ExpressionTree iterableExpression
If this MethodInvocationNode is a node for anIterator.next()
desugared from an enhanced for loop, then theiterExpression
field is the expression in the for loop, e.g.,iter
infor(Object o: iter
.Is set by
setIterableExpression(com.sun.source.tree.ExpressionTree)
.
-
-
Constructor Detail
-
MethodInvocationNode
public MethodInvocationNode(@Nullable com.sun.source.tree.MethodInvocationTree tree, MethodAccessNode target, java.util.List<Node> arguments, com.sun.source.util.TreePath treePath)
Create a MethodInvocationNode.- Parameters:
tree
- for the method invocationtarget
- the MethodAccessNode for the method being invokedarguments
- arguments of the method invocationtreePath
- path to the method invocation
-
MethodInvocationNode
public MethodInvocationNode(MethodAccessNode target, java.util.List<Node> arguments, com.sun.source.util.TreePath treePath)
-
-
Method Detail
-
getTarget
public MethodAccessNode getTarget()
-
getArguments
public java.util.List<Node> getArguments()
-
getArgument
public Node getArgument(int i)
-
getTreePath
public com.sun.source.util.TreePath getTreePath()
-
getIterableExpression
public @Nullable com.sun.source.tree.ExpressionTree getIterableExpression()
If this MethodInvocationNode is a node for anIterator.next()
desugared from an enhanced for loop, then return the expression in the for loop, e.g.,iter
infor(Object o: iter
. Otherwise, return null.- Returns:
- the iter expression, or null if this is not a
Iterator.next()
from an enhanced for loop
-
setIterableExpression
public void setIterableExpression(@Nullable com.sun.source.tree.ExpressionTree iterableExpression)
Set the iterable expression from a for loop.- Parameters:
iterableExpression
- iterable expression- See Also:
getIterableExpression()
-
getTree
public @Nullable com.sun.source.tree.MethodInvocationTree getTree()
Description copied from class:Node
Returns theTree
in the abstract syntax tree, ornull
if no corresponding tree exists. For instance, this is the case for anImplicitThisNode
.
-
accept
public <R,P> R accept(NodeVisitor<R,P> visitor, P p)
Description copied from class:Node
Accept method of the visitor pattern.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getOperands
@SideEffectFree public java.util.Collection<Node> getOperands()
Description copied from class:Node
- Specified by:
getOperands
in classNode
- Returns:
- a collection containing all of the operand
Node
s of thisNode
-
-