Class NewExpr

  • All Implemented Interfaces:
    Opcode

    public class NewExpr
    extends Expr
    Object creation (new expression).
    • Method Detail

      • where

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

        public int getLineNumber()
        Returns the line number of the source line containing the new expression.
        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 new expression.
        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 created object.
      • getSignature

        public java.lang.String getSignature()
        Get the signature of the constructor The signature is represented by a character string called method descriptor, which is defined in the JVM specification.
        Returns:
        the signature
        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
      • replace

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

        $0 is available but the value is null.

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