Class MethodCall

java.lang.Object
javassist.expr.Expr
javassist.expr.MethodCall
All Implemented Interfaces:
Opcode
Direct Known Subclasses:
ConstructorCall

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

    • 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 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 String getClassName()
      Returns the class name of the target object, which the method is called on.
    • getMethodName

      public String getMethodName()
      Returns the name of the called method.
    • getMethod

      public CtMethod getMethod() throws NotFoundException
      Returns the called method.
      Throws:
      NotFoundException
    • getSignature

      public 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:
    • 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(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