Class Expr

java.lang.Object
javassist.expr.Expr
All Implemented Interfaces:
Opcode
Direct Known Subclasses:
Cast, FieldAccess, Handler, Instanceof, MethodCall, NewArray, NewExpr

public abstract class Expr extends Object implements Opcode
Expression.
  • Field Details

  • Constructor Details

  • Method Details

    • getEnclosingClass

      public CtClass getEnclosingClass()
      Returns the class that declares the method enclosing this expression.
      Since:
      3.7
    • getConstPool

      protected final ConstPool getConstPool()
    • edited

      protected final boolean edited()
    • locals

      protected final int locals()
    • stack

      protected final int stack()
    • withinStatic

      protected final boolean withinStatic()
      Returns true if this method is static.
    • where

      public CtBehavior where()
      Returns the constructor or method containing the expression.
    • 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.
    • addClass

      private static void addClass(List<CtClass> list, CtClass c)
    • indexOfBytecode

      public int indexOfBytecode()
      Returns the index of the bytecode corresponding to the expression. It is the index into the byte array containing the Java bytecode that implements the method.
    • getLineNumber

      public int getLineNumber()
      Returns the line number of the source line containing the expression.
      Returns:
      -1 if this information is not available.
    • getFileName

      public String getFileName()
      Returns the source file containing the expression.
      Returns:
      null if this information is not available.
    • checkResultValue

      static final boolean checkResultValue(CtClass retType, String prog) throws CannotCompileException
      Throws:
      CannotCompileException
    • storeStack

      static final void storeStack(CtClass[] params, boolean isStaticCall, int regno, Bytecode bytecode)
    • storeStack0

      private static void storeStack0(int i, int n, CtClass[] params, int regno, Bytecode bytecode)
    • replace

      public abstract void replace(String statement) throws CannotCompileException
      Replaces this expression with the bytecode derived from the given source text.
      Parameters:
      statement - a Java statement except try-catch.
      Throws:
      CannotCompileException
    • replace

      public void replace(String statement, ExprEditor recursive) throws CannotCompileException
      Replaces this expression with the bytecode derived from the given source text and ExprEditor.
      Parameters:
      statement - a Java statement except try-catch.
      recursive - if not null, the substituted bytecode is recursively processed by the given ExprEditor.
      Throws:
      CannotCompileException
      Since:
      3.1
    • replace0

      protected void replace0(int pos, Bytecode bytecode, int size) throws BadBytecode
      Throws:
      BadBytecode
    • runEditor

      protected void runEditor(ExprEditor ed, CodeIterator oldIterator) throws CannotCompileException
      Throws:
      CannotCompileException