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 containMethodInvocationNodes 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>argumentsThe arguments of the method invocation.protected @Nullable com.sun.source.tree.ExpressionTreeiterableExpressionIf 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 MethodAccessNodetargetThe MethodAccessNode for the method being invoked.protected @Nullable com.sun.source.tree.MethodInvocationTreetreeThe tree for the method invocation.protected com.sun.source.util.TreePathtreePathThe 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.booleanequals(@Nullable java.lang.Object obj)NodegetArgument(int i)java.util.List<Node>getArguments()@Nullable com.sun.source.tree.ExpressionTreegetIterableExpression()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.,iterinfor(Object o: iter.java.util.Collection<Node>getOperands()MethodAccessNodegetTarget()@Nullable com.sun.source.tree.MethodInvocationTreegetTree()Returns theTreein the abstract syntax tree, ornullif no corresponding tree exists.com.sun.source.util.TreePathgetTreePath()inthashCode()voidsetIterableExpression(@Nullable com.sun.source.tree.ExpressionTree iterableExpression)Set the iterable expression from a for loop.java.lang.StringtoString()-
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 theiterExpressionfield is the expression in the for loop, e.g.,iterinfor(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.,iterinfor(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:NodeReturns theTreein the abstract syntax tree, ornullif 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:NodeAccept method of the visitor pattern.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getOperands
@SideEffectFree public java.util.Collection<Node> getOperands()
Description copied from class:Node- Specified by:
getOperandsin classNode- Returns:
- a collection containing all of the operand
Nodes of thisNode
-
-