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 can 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 might 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. For an invocation that is not in the source code (see Node.getInSource()), such as the invocation of iterator() 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

      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).

    • enhancedForLoop

      protected @Nullable EnhancedForLoopTree enhancedForLoop
      If this MethodInvocationNode is a node for an Iterator.next() desugared from an enhanced for loop, then the enhancedForLoop field is the EnhancedForLoopTree AST node.

      Is set by setEnhancedForLoop(com.sun.source.tree.EnhancedForLoopTree).

  • Constructor Details

  • Method Details

    • getTarget

      public MethodAccessNode getTarget()
    • getArguments

      public List<Node> getArguments()
    • getArgument

      public Node getArgument(int i)
    • getTreePath

      public TreePath getTreePath()
      Returns the tree path to the method invocation. For an invocation that is not in the source code (see Node.getInSource()), such as the invocation of iterator() 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

      public @Nullable ExpressionTree getIterableExpression()
      If this MethodInvocationNode is a node for an Iterator.next() desugared from an enhanced for loop, then returns the expression in the for loop, e.g., iter in for(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

      public @Nullable EnhancedForLoopTree getEnhancedForLoop()
      If this MethodInvocationNode is a node for an Iterator.next() desugared from an enhanced for loop, then returns the corresponding EnhancedForLoopTree AST node. Otherwise, returns null.
      Returns:
      the EnhancedForLoopTree, or null if this is not an Iterator.next() from an enhanced for loop
    • setIterableExpression

      public void setIterableExpression(@Nullable ExpressionTree iterableExpression)
      Sets the iterable expression from a for loop.
      Parameters:
      iterableExpression - iterable expression
      See Also:
    • setEnhancedForLoop

      public void setEnhancedForLoop(@Nullable EnhancedForLoopTree enhancedForLoop)
      Sets the enhanced for loop for which this is the desugared loop update.
      Parameters:
      enhancedForLoop - the EnhancedForLoopTree
      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
      Returns:
      the result of visiting this node
    • 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