Class 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 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 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 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 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,
                                    java.util.List<Node> arguments,
                                    com.sun.source.util.TreePath treePath)
    • Method Detail

      • 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 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 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 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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(@Nullable java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        @SideEffectFree
        public java.util.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