Class MethodCall

  • All Implemented Interfaces:
    Opcode
    Direct Known Subclasses:
    ConstructorCall

    public class MethodCall
    extends Expr
    Method invocation (caller-side expression).
    • Method Detail

      • where

        public CtBehavior where()
        Returns the method or constructor containing the method-call expression represented by this object.
        Overrides:
        where in class Expr
      • getLineNumber

        public int getLineNumber()
        Returns the line number of the source line containing the method call.
        Overrides:
        getLineNumber in class Expr
        Returns:
        -1 if this information is not available.
      • getFileName

        public java.lang.String getFileName()
        Returns the source file containing the method call.
        Overrides:
        getFileName in class Expr
        Returns:
        null if this information is not available.
      • getClassName

        public java.lang.String getClassName()
        Returns the class name of the target object, which the method is called on.
      • getMethodName

        public java.lang.String getMethodName()
        Returns the name of the called method.
      • getSignature

        public java.lang.String getSignature()
        Returns the method signature (the parameter types and the return type). The method signature is represented by a character string called method descriptor, which is defined in the JVM specification.
        Since:
        3.1
        See Also:
        CtBehavior.getSignature(), Descriptor
      • mayThrow

        public CtClass[] mayThrow()
        Returns the list of exceptions that the expression may throw. This list includes both the exceptions that the try-catch statements including the expression can catch and the exceptions that the throws declaration allows the method to throw.
        Overrides:
        mayThrow in class Expr
      • isSuper

        public boolean isSuper()
        Returns true if the called method is of a superclass of the current class.
      • replace

        public void replace​(java.lang.String statement)
                     throws CannotCompileException
        Replaces the method call with the bytecode derived from the given source text.

        $0 is available even if the called method is static.

        Specified by:
        replace in class Expr
        Parameters:
        statement - a Java statement except try-catch.
        Throws:
        CannotCompileException