Top Description Fields Constructors Methods
javassist.expr

public abstract Class Expr

extends Object
implements Opcode
Class Inheritance
All Implemented Interfaces
javassist.bytecode.Opcode
Known Direct Subclasses
javassist.expr.FieldAccess, javassist.expr.Handler, javassist.expr.Instanceof, javassist.expr.MethodCall, javassist.expr.NewArray, javassist.expr.NewExpr, javassist.expr.Cast
Imports
java.util.LinkedList, .List, javassist.CannotCompileException, .ClassPool, .CtBehavior, .CtClass, .CtConstructor, .CtPrimitiveType, .NotFoundException, javassist.bytecode.AccessFlag, .BadBytecode, .Bytecode, .ClassFile, .CodeAttribute, .CodeIterator, .ConstPool, .ExceptionTable, .ExceptionsAttribute, .MethodInfo, .Opcode, javassist.compiler.Javac

Expression.

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv boolean
pack-priv CodeIterator
pack-priv static final String
pack-priv int
pack-priv int
pack-priv CtClass
pack-priv MethodInfo

Constructor Summary

AccessConstructor and Description
protected
Expr(int pos, CodeIterator i, CtClass declaring, MethodInfo m)

Undocumented constructor.

Method Summary

Modifier and TypeMethod and Description
private static void
pack-priv static final boolean
protected final boolean
protected final ConstPool
public CtClass
getEnclosingClass()

Returns the class that declares the method enclosing this expression.

public String

Returns:

null if this information is not available.
getFileName
()

Returns the source file containing the expression.

public int

Returns:

-1 if this information is not available.
getLineNumber
()

Returns the line number of the source line containing the expression.

public int
indexOfBytecode()

Returns the index of the bytecode corresponding to the expression.

protected final int
public CtClass[]
mayThrow()

Returns the list of exceptions that the expression may throw.

public abstract void
replace(String
a Java statement except try-catch.
statement
)

Replaces this expression with the bytecode derived from the given source text.

public void
replace(String
a Java statement except try-catch.
statement
,
ExprEditor
if not null, the substituted bytecode is recursively processed by the given ExprEditor.
recursive
)

Replaces this expression with the bytecode derived from the given source text and ExprEditor.

protected void
replace0(int pos, Bytecode bytecode, int size)

protected void
protected final int
pack-priv static final void
storeStack(CtClass[] params, boolean isStaticCall, int regno, Bytecode bytecode)

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

public CtBehavior
where()

Returns the constructor or method containing the expression.

protected final boolean
withinStatic()

Returns true if this method is static.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentPosback to summary
pack-priv int currentPos
editedback to summary
pack-priv boolean edited
iteratorback to summary
pack-priv CodeIterator iterator
javaLangObjectback to summary
pack-priv static final String javaLangObject
maxLocalsback to summary
pack-priv int maxLocals
maxStackback to summary
pack-priv int maxStack
thisClassback to summary
pack-priv CtClass thisClass
thisMethodback to summary
pack-priv MethodInfo thisMethod

Constructor Detail

Exprback to summary
protected Expr(int pos, CodeIterator i, CtClass declaring, MethodInfo m)

Undocumented constructor. Do not use; internal-use only.

Method Detail

addClassback to summary
private static void addClass(List<CtClass> list, CtClass c)
checkResultValueback to summary
pack-priv static final boolean checkResultValue(CtClass retType, String prog) throws CannotCompileException
editedback to summary
protected final boolean edited()
getConstPoolback to summary
protected final ConstPool getConstPool()
getEnclosingClassback to summary
public CtClass getEnclosingClass()

Returns the class that declares the method enclosing this expression.

Since
3.7
getFileNameback to summary
public String getFileName()

Returns the source file containing the expression.

Returns:String

null if this information is not available.

getLineNumberback to summary
public int getLineNumber()

Returns the line number of the source line containing the expression.

Returns:int

-1 if this information is not available.

indexOfBytecodeback to summary
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.

localsback to summary
protected final int locals()
mayThrowback to summary
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.

replaceback to summary
public abstract void replace(String statement) throws CannotCompileException

Replaces this expression with the bytecode derived from the given source text.

Parameters
statement:String

a Java statement except try-catch.

replaceback to summary
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:String

a Java statement except try-catch.

recursive:ExprEditor

if not null, the substituted bytecode is recursively processed by the given ExprEditor.

Since
3.1
replace0back to summary
protected void replace0(int pos, Bytecode bytecode, int size) throws BadBytecode
runEditorback to summary
protected void runEditor(ExprEditor ed, CodeIterator oldIterator) throws CannotCompileException
stackback to summary
protected final int stack()
storeStackback to summary
pack-priv static final void storeStack(CtClass[] params, boolean isStaticCall, int regno, Bytecode bytecode)
storeStack0back to summary
private static void storeStack0(int i, int n, CtClass[] params, int regno, Bytecode bytecode)
whereback to summary
public CtBehavior where()

Returns the constructor or method containing the expression.

withinStaticback to summary
protected final boolean withinStatic()

Returns true if this method is static.