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 contain MethodInvocationNodes that correspond to no AST Tree, in which case, the tree field will be null.
  • Field Details

    • tree

      protected final @Nullable 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 List<Node> arguments
      The arguments of the method invocation.
    • treePath

      protected final TreePath treePath
      The tree path to the method invocation.
    • iterableExpression

      protected @Nullable ExpressionTree iterableExpression
      If this MethodInvocationNode is a node for an Iterator.next() desugared from an enhanced for loop, then the iterExpression field is the expression in the for loop, e.g., iter in for(Object o: iter.

      Is set by setIterableExpression(com.sun.source.tree.ExpressionTree).

  • Constructor Details

    • MethodInvocationNode

      public MethodInvocationNode(@Nullable MethodInvocationTree tree, MethodAccessNode target, List<Node> arguments, TreePath treePath)
      Create a MethodInvocationNode.
      Parameters:
      tree - for the method invocation
      target - the MethodAccessNode for the method being invoked
      arguments - arguments of the method invocation
      treePath - path to the method invocation
    • MethodInvocationNode

      public MethodInvocationNode(MethodAccessNode target, List<Node> arguments, TreePath treePath)
  • Method Details

    • getTarget

      public MethodAccessNode getTarget()
    • getArguments

      public List<Node> getArguments()
    • getArgument

      public Node getArgument(int i)
    • getTreePath

      public TreePath getTreePath()
    • getIterableExpression

      public @Nullable ExpressionTree getIterableExpression()
      If this MethodInvocationNode is a node for an Iterator.next() desugared from an enhanced for loop, then return the expression in the for loop, e.g., iter in for(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 ExpressionTree iterableExpression)
      Set the iterable expression from a for loop.
      Parameters:
      iterableExpression - iterable expression
      See Also:
    • getTree

      public @Nullable MethodInvocationTree getTree()
      Description copied from class: Node
      Returns the Tree in the abstract syntax tree, or null if no corresponding tree exists. For instance, this is the case for an ImplicitThisNode.
      Specified by:
      getTree in class Node
      Returns:
      the corresponding Tree or null
    • accept

      public <R, P> R accept(NodeVisitor<R,P> visitor, P p)
      Description copied from class: Node
      Accept method of the visitor pattern.
      Specified by:
      accept in class Node
      Type Parameters:
      R - result type of the operation
      P - parameter type
      Parameters:
      visitor - the visitor to be applied to this node
      p - the parameter for this operation
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getOperands

      @SideEffectFree public Collection<Node> getOperands()
      Description copied from class: Node
      Returns a collection containing all of the operand Nodes of this Node.
      Specified by:
      getOperands in class Node
      Returns:
      a collection containing all of the operand Nodes of this Node