Package | Description |
---|---|
javassist |
The Javassist Core API.
|
javassist.bytecode |
Bytecode-level API.
|
javassist.bytecode.analysis |
Bytecode Analysis API.
|
javassist.bytecode.stackmap | |
javassist.convert | |
javassist.expr |
This package contains the classes for modifying a method body.
|
javassist.tools.reflect |
Runtime Behavioral Reflection.
|
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
CtNewWrappedMethod.addBodyMethod(CtClassType clazz,
ClassFile classfile,
CtMethod src) |
private void |
CtBehavior.addParameter2(int where,
CtClass type,
java.lang.String desc) |
private static void |
CtClassType.insertAuxInitializer(CodeAttribute codeAttr,
Bytecode initializer,
int stacksize) |
private void |
CtBehavior.insertGoto(CodeIterator iterator,
int subr,
int pos) |
Modifier and Type | Method and Description |
---|---|
private static BadBytecode |
SignatureAttribute.error(java.lang.String sig) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
CodeIterator.Switcher.adjustOffsets(int size,
int nops) |
private int |
StackMapTable.Walker.appendFrame(int pos,
int type) |
void |
StackMapTable.Walker.appendFrame(int pos,
int offsetDelta,
int[] tags,
int[] data)
Invoked if the visited frame is a
append_frame . |
(package private) static byte[] |
CodeIterator.changeLdcToLdcW(byte[] code,
ExceptionTable etable,
CodeAttribute ca,
CodeAttribute.LdcEntry ldcs) |
private void |
CodeAnalyzer.checkTarget(int opIndex,
int target,
int codeLength,
int[] stack,
int stackDepth) |
void |
StackMapTable.Walker.chopFrame(int pos,
int offsetDelta,
int k)
Invoked if the visited frame is a
chop_frame . |
int |
CodeAnalyzer.computeMaxStack() |
int |
CodeAttribute.computeMaxStack()
Computes the maximum stack size and sets
max_stack
to the computed size. |
private static CodeAttribute.LdcEntry |
CodeAttribute.copyCode(byte[] code,
int beginPos,
int endPos,
ConstPool srcCp,
byte[] newcode,
ConstPool destCp,
java.util.Map classnameMap) |
private byte[] |
CodeAttribute.copyCode(ConstPool destCp,
java.util.Map classnames,
ExceptionTable etable,
CodeAttribute destCa)
Copies code.
|
byte[] |
StackMapTable.SimpleCopy.doit() |
void |
StackMapTable.Shifter.doit() |
(package private) static byte[] |
CodeAttribute.LdcEntry.doit(byte[] code,
CodeAttribute.LdcEntry ldc,
ExceptionTable etable,
CodeAttribute ca) |
private int |
StackMapTable.Walker.fullFrame(int pos) |
void |
StackMapTable.Walker.fullFrame(int pos,
int offsetDelta,
int[] localTags,
int[] localData,
int[] stackTags,
int[] stackData)
Invoked if the visited frame is
full_frame . |
(package private) int |
SignatureAttribute.Cursor.indexOf(java.lang.String s,
int ch) |
int |
CodeIterator.insert(byte[] code)
Inserts the given bytecode sequence
before the next instruction that would be returned by
next() (not before the instruction returned
by the last call to next() ). |
void |
CodeIterator.insert(int pos,
byte[] code)
Inserts the given bytecode sequence
before the instruction at the given index
pos . |
private int |
CodeIterator.insert0(int pos,
byte[] code,
boolean exclusive) |
int |
CodeIterator.insertAt(int pos,
byte[] code)
Inserts the given bytecode sequence
before the instruction at the given index
pos . |
int |
CodeIterator.insertEx(byte[] code)
Inserts the given bytecode sequence exclusively
before the next instruction that would be returned by
next() (not before the instruction returned
by tha last call to next() ). |
void |
CodeIterator.insertEx(int pos,
byte[] code)
Inserts the given bytecode sequence exclusively
before the instruction at the given index
pos . |
int |
CodeIterator.insertExAt(int pos,
byte[] code)
Inserts the given bytecode sequence exclusively
before the instruction at the given index
pos . |
int |
CodeIterator.insertExGap(int length)
Inserts an exclusive gap
before the next instruction that would be returned by
next() (not before the instruction returned
by the last call to next() ). |
int |
CodeIterator.insertExGap(int pos,
int length)
Inserts an exclusive gap in front of the instruction at the given
index
pos . |
int |
CodeIterator.insertGap(int length)
Inserts a gap
before the next instruction that would be returned by
next() (not before the instruction returned
by the last call to next() ). |
int |
CodeIterator.insertGap(int pos,
int length)
Inserts a gap in front of the instruction at the given
index
pos . |
private static void |
CodeIterator.insertGap2(byte[] code,
int where,
int gapLength,
int endPos,
byte[] newcode,
boolean exclusive) |
private static byte[] |
CodeIterator.insertGap2w(byte[] code,
int where,
int gapLength,
boolean exclusive,
java.util.ArrayList jumps,
CodeIterator.Pointers ptrs) |
CodeIterator.Gap |
CodeIterator.insertGapAt(int pos,
int length,
boolean exclusive)
Inserts an inclusive or exclusive gap in front of the instruction
at the given index
pos . |
(package private) static byte[] |
CodeIterator.insertGapCore0(byte[] code,
int where,
int gapLength,
boolean exclusive,
ExceptionTable etable,
CodeAttribute ca)
insertGapCore0() inserts a gap (some NOPs).
|
private byte[] |
CodeIterator.insertGapCore0w(byte[] code,
int where,
int gapLength,
boolean exclusive,
ExceptionTable etable,
CodeAttribute ca,
CodeIterator.Gap newWhere) |
private static byte[] |
CodeIterator.insertGapCore1(byte[] code,
int where,
int gapLength,
boolean exclusive,
ExceptionTable etable,
CodeAttribute ca) |
void |
StackMap.insertLocal(int index,
int tag,
int classInfo)
Updates this stack map table when a new local variable is inserted
for a new parameter.
|
void |
StackMapTable.insertLocal(int index,
int tag,
int classInfo)
Updates this stack map table when a new local variable is inserted
for a new parameter.
|
void |
CodeAttribute.insertLocalVar(int where,
int size)
Changes the index numbers of the local variables
to append a new parameter.
|
private static byte[] |
CodeIterator.makeExapndedCode(byte[] code,
java.util.ArrayList jumps,
int where,
int gapLength) |
private static java.util.ArrayList |
CodeIterator.makeJumpList(byte[] code,
int endPos,
CodeIterator.Pointers ptrs) |
int |
CodeIterator.next()
Returns the index of the next instruction
(not the operand following the current opcode).
|
(package private) static int |
CodeIterator.nextOpcode(byte[] code,
int index)
Calculates the index of the next opcode.
|
void |
StackMapTable.Walker.parse()
Visits each entry of the stack map frames.
|
private static SignatureAttribute.ObjectType |
SignatureAttribute.parseArray(java.lang.String sig,
SignatureAttribute.Cursor c) |
private static SignatureAttribute.ClassType |
SignatureAttribute.parseClassType(java.lang.String sig,
SignatureAttribute.Cursor c) |
private static SignatureAttribute.ClassType |
SignatureAttribute.parseClassType2(java.lang.String sig,
SignatureAttribute.Cursor c,
SignatureAttribute.ClassType parent) |
private static SignatureAttribute.MethodSignature |
SignatureAttribute.parseMethodSig(java.lang.String sig) |
private static SignatureAttribute.ObjectType |
SignatureAttribute.parseObjectType(java.lang.String sig,
SignatureAttribute.Cursor c,
boolean dontThrow) |
private static SignatureAttribute.ClassSignature |
SignatureAttribute.parseSig(java.lang.String sig) |
private static SignatureAttribute.Type |
SignatureAttribute.parseType(java.lang.String sig,
SignatureAttribute.Cursor c) |
private static SignatureAttribute.TypeArgument[] |
SignatureAttribute.parseTypeArgs(java.lang.String sig,
SignatureAttribute.Cursor c) |
private static SignatureAttribute.TypeParameter[] |
SignatureAttribute.parseTypeParams(java.lang.String sig,
SignatureAttribute.Cursor cur) |
private boolean |
CodeAnalyzer.processBranch(int opcode,
CodeIterator ci,
int index,
int codeLength,
int[] stack,
int stackDepth,
int[] jsrDepth) |
private void |
MethodInfo.read(MethodInfo src,
java.lang.String methodname,
java.util.Map classnames) |
void |
MethodInfo.rebuildStackMap(ClassPool pool)
Rebuilds a stack map table.
|
void |
MethodInfo.rebuildStackMapForME(ClassPool pool)
Rebuilds a stack map table for J2ME (CLDC).
|
void |
MethodInfo.rebuildStackMapIf6(ClassPool pool,
ClassFile cf)
Rebuilds a stack map table if the class file is for Java 6
or later.
|
void |
StackMapTable.Walker.sameFrame(int pos,
int offsetDelta)
Invoked if the visited frame is a
same_frame or
a same_frame_extended . |
private int |
StackMapTable.Walker.sameLocals(int pos,
int type) |
void |
StackMapTable.Walker.sameLocals(int pos,
int offsetDelta,
int stackTag,
int stackData)
Invoked if the visited frame is a
same_locals_1_stack_item_frame
or a same_locals_1_stack_item_frame_extended . |
void |
MethodInfo.setSuperclass(java.lang.String superclass)
Changes a super constructor called by this constructor.
|
(package private) void |
StackMap.shiftForSwitch(int where,
int gapSize) |
(package private) void |
StackMapTable.shiftForSwitch(int where,
int gapSize) |
(package private) void |
CodeIterator.Pointers.shiftForSwitch(int where,
int gapLength) |
private static void |
CodeAttribute.shiftIndex(CodeIterator ci,
int lessThan,
int delta) |
private static void |
CodeAttribute.shiftIndex0(CodeIterator ci,
int index,
int opcode,
int lessThan,
int delta,
int opcode_i_0,
int opcode_i) |
private static void |
CodeAttribute.shiftIndex8(CodeIterator ci,
int index,
int opcode,
int lessThan,
int delta) |
(package private) void |
StackMap.shiftPc(int where,
int gapSize,
boolean exclusive) |
(package private) void |
StackMapTable.shiftPc(int where,
int gapSize,
boolean exclusive) |
(package private) void |
CodeIterator.Pointers.shiftPc(int where,
int gapLength,
boolean exclusive) |
int |
CodeIterator.skipConstructor()
Moves to the instruction for
either
super() or this() . |
int |
CodeIterator.skipSuperConstructor()
Moves to the instruction for
super() . |
private int |
CodeIterator.skipSuperConstructor0(int skipThis) |
int |
CodeIterator.skipThisConstructor()
Moves to the instruction for
this() . |
(package private) int |
StackMapTable.Walker.stackMapFrames(int pos,
int nth)
Invoked when the next entry of the stack map frames is visited.
|
static SignatureAttribute.ClassSignature |
SignatureAttribute.toClassSignature(java.lang.String sig)
Parses the given signature string as a class signature.
|
static SignatureAttribute.ObjectType |
SignatureAttribute.toFieldSignature(java.lang.String sig)
Parses the given signature string as a field type signature.
|
static SignatureAttribute.MethodSignature |
SignatureAttribute.toMethodSignature(java.lang.String sig)
Parses the given signature string as a method type signature.
|
static SignatureAttribute.Type |
SignatureAttribute.toTypeSignature(java.lang.String sig)
Parses the given signature string as a type signature.
|
private void |
CodeAnalyzer.visitBytecode(CodeIterator ci,
int[] stack,
int index) |
private int |
CodeAnalyzer.visitInst(int op,
CodeIterator ci,
int index,
int stack)
Visits an instruction.
|
(package private) abstract int |
CodeIterator.Branch.write(int srcPos,
byte[] code,
int destPos,
byte[] newcode) |
(package private) int |
CodeIterator.Switcher.write(int src,
byte[] code,
int dest,
byte[] newcode) |
Constructor and Description |
---|
CodeAttribute(ConstPool cp,
CodeAttribute src,
java.util.Map classnames)
Constructs a copy of
Code_attribute . |
MethodInfo(ConstPool cp,
java.lang.String methodname,
MethodInfo src,
java.util.Map classnameMap)
Constructs a copy of
method_info structure. |
Modifier and Type | Method and Description |
---|---|
Frame[] |
Analyzer.analyze(CtClass clazz,
MethodInfo method)
Performs data-flow analysis on a method and returns an array, indexed by
instruction position, containing the starting frame state of all reachable
instructions.
|
Frame[] |
Analyzer.analyze(CtMethod method)
Performs data-flow analysis on a method and returns an array, indexed by
instruction position, containing the starting frame state of all reachable
instructions.
|
private void |
Analyzer.analyzeNextEntry(MethodInfo method,
CodeIterator iter,
IntQueue queue,
Executor executor) |
private void |
Executor.evalArrayLoad(Type expectedComponent,
Frame frame) |
private void |
Executor.evalArrayStore(Type expectedComponent,
Frame frame) |
private void |
Executor.evalBinaryMath(Type expected,
Frame frame) |
private void |
Executor.evalGetField(int opcode,
int index,
Frame frame) |
private void |
Executor.evalInvokeDynamic(int opcode,
int index,
Frame frame) |
private void |
Executor.evalInvokeIntfMethod(int opcode,
int index,
Frame frame) |
private void |
Executor.evalInvokeMethod(int opcode,
int index,
Frame frame) |
private void |
Executor.evalLDC(int index,
Frame frame) |
private void |
Executor.evalLoad(Type expected,
int index,
Frame frame,
Subroutine subroutine) |
private void |
Executor.evalNewArray(int pos,
CodeIterator iter,
Frame frame) |
private void |
Executor.evalNewObjectArray(int pos,
CodeIterator iter,
Frame frame) |
private void |
Executor.evalPutField(int opcode,
int index,
Frame frame) |
private void |
Executor.evalShift(Type expected,
Frame frame) |
private void |
Executor.evalStore(Type expected,
int index,
Frame frame,
Subroutine subroutine) |
private void |
Executor.evalWide(int pos,
CodeIterator iter,
Frame frame,
Subroutine subroutine) |
void |
Executor.execute(MethodInfo method,
int pos,
CodeIterator iter,
Frame frame,
Subroutine subroutine)
Execute the instruction, modeling the effects on the specified frame and subroutine.
|
Frame |
ControlFlow.frameAt(int pos)
Returns the types of the local variables and stack frame entries
available at the given position.
|
private int |
Analyzer.getNext(CodeIterator iter,
int of,
int restore) |
private Type |
Executor.getType(java.lang.String name) |
private int |
Analyzer.lookAhead(CodeIterator iter,
int pos) |
private void |
Analyzer.mergeJsr(IntQueue queue,
Frame frame,
Subroutine sub,
int pos,
int next) |
private void |
Analyzer.mergeLookupSwitch(IntQueue queue,
int pos,
CodeIterator iter,
Frame frame) |
private void |
Analyzer.mergeRet(IntQueue queue,
CodeIterator iter,
int pos,
Frame frame,
Subroutine subroutine) |
private void |
Analyzer.mergeTableSwitch(IntQueue queue,
int pos,
CodeIterator iter,
Frame frame) |
private Type[] |
Executor.paramTypesFromDesc(java.lang.String desc) |
private Type |
Executor.resolveClassInfo(java.lang.String info) |
private Type |
Executor.returnTypeFromDesc(java.lang.String desc) |
private void |
SubroutineScanner.scan(int pos,
CodeIterator iter,
Subroutine sub) |
Subroutine[] |
SubroutineScanner.scan(MethodInfo method) |
private void |
SubroutineScanner.scanLookupSwitch(int pos,
CodeIterator iter,
Subroutine sub) |
private boolean |
SubroutineScanner.scanOp(int pos,
CodeIterator iter,
Subroutine sub) |
private void |
SubroutineScanner.scanTableSwitch(int pos,
CodeIterator iter,
Subroutine sub) |
private Type |
Executor.typeFromDesc(java.lang.String desc) |
private void |
Executor.verifyAssignable(Type expected,
Type type) |
Constructor and Description |
---|
ControlFlow(CtClass ctclazz,
MethodInfo minfo)
Constructs a control-flow analyzer.
|
ControlFlow(CtMethod method)
Constructs a control-flow analyzer for the given method.
|
Modifier and Type | Class and Description |
---|---|
(package private) static class |
BasicBlock.JsrBytecode |
Modifier and Type | Method and Description |
---|---|
static void |
TypeData.aastore(TypeData array,
TypeData value,
ClassPool cp) |
private void |
BasicBlock.Maker.addCatchers(BasicBlock[] blocks,
ExceptionTable et) |
private void |
Tracer.checkParamTypes(java.lang.String desc,
int i) |
private static int |
TypedBlock.descToTag(java.lang.String desc,
int i,
int n,
TypeData[] types) |
private int |
Tracer.doGetField(int pos,
byte[] code,
boolean notStatic) |
private int |
Tracer.doInvokeDynamic(int pos,
byte[] code) |
private int |
Tracer.doInvokeIntfMethod(int pos,
byte[] code) |
private int |
Tracer.doInvokeMethod(int pos,
byte[] code,
boolean notStatic) |
protected int |
Tracer.doOpcode(int pos,
byte[] code)
Does abstract interpretation on the given bytecode instruction.
|
private int |
Tracer.doOpcode0_53(int pos,
byte[] code,
int op) |
private int |
Tracer.doOpcode148_201(int pos,
byte[] code,
int op) |
private int |
Tracer.doOpcode54_95(int pos,
byte[] code,
int op) |
private int |
Tracer.doPutField(int pos,
byte[] code,
boolean notStatic) |
private int |
Tracer.doWIDE(int pos,
byte[] code) |
static BasicBlock |
BasicBlock.find(BasicBlock[] blocks,
int pos) |
private void |
MapMaker.findDeadCatchers(byte[] code,
TypedBlock[] blocks) |
private void |
MapMaker.fixDeadcode(byte[] code,
TypedBlock block) |
private void |
MapMaker.fixTypes(byte[] code,
TypedBlock[] blocks) |
(package private) void |
TypedBlock.initFirstBlock(int maxStack,
int maxLocals,
java.lang.String className,
java.lang.String methodDesc,
boolean isStatic,
boolean isConstructor)
Initializes the first block by the given method descriptor.
|
private void |
MapMaker.make(byte[] code,
TypedBlock tb) |
static StackMapTable |
MapMaker.make(ClassPool classes,
MethodInfo minfo)
Computes the stack map table of the given method and returns it.
|
BasicBlock[] |
BasicBlock.Maker.make(CodeIterator ci,
int begin,
int end,
ExceptionTable et) |
BasicBlock[] |
BasicBlock.Maker.make(MethodInfo minfo) |
(package private) static TypeData |
TypeData.ArrayType.make(TypeData element) |
static TypeData |
TypeData.ArrayElement.make(TypeData array) |
(package private) void |
MapMaker.make(TypedBlock[] blocks,
byte[] code)
Runs an analyzer (Phase 1 and 2).
|
static StackMap |
MapMaker.make2(ClassPool classes,
MethodInfo minfo)
Computes the stack map table for J2ME.
|
static TypedBlock[] |
TypedBlock.makeBlocks(MethodInfo minfo,
CodeAttribute ca,
boolean optimize)
Divides the method body into basic blocks.
|
protected void |
BasicBlock.Maker.makeJsr(java.util.HashMap marks,
int pos,
int target,
int size) |
private java.util.HashMap |
BasicBlock.Maker.makeMarks(CodeIterator ci,
int begin,
int end,
ExceptionTable et) |
private TypeData |
MapMaker.merge(TypeData src,
TypeData target) |
private void |
MapMaker.mergeMap(TypedBlock dest,
boolean mergeStack) |
private void |
MapMaker.recordStackMap(TypedBlock target) |
private void |
MapMaker.recordStackMap(TypedBlock target,
int exceptionType) |
private void |
MapMaker.recordStackMap0(TypedBlock target,
int st,
TypeData[] tStackTypes) |
private void |
Tracer.setFieldTarget(boolean notStatic,
int index) |
void |
TypedBlock.setStackMap(int st,
TypeData[] stack,
int nl,
TypeData[] locals) |
abstract void |
TypeData.setType(java.lang.String s,
ClassPool cp) |
void |
TypeData.BasicType.setType(java.lang.String s,
ClassPool cp) |
void |
TypeData.TypeVar.setType(java.lang.String typeName,
ClassPool cp) |
void |
TypeData.ArrayType.setType(java.lang.String s,
ClassPool cp) |
void |
TypeData.ArrayElement.setType(java.lang.String s,
ClassPool cp) |
void |
TypeData.UninitTypeVar.setType(java.lang.String s,
ClassPool cp) |
void |
TypeData.ClassName.setType(java.lang.String typeName,
ClassPool cp) |
private static void |
TypeData.setType(TypeData td,
java.lang.String className,
ClassPool cp)
Sets the type name of this object type.
|
private void |
MapMaker.traceException(byte[] code,
BasicBlock.Catch handler) |
protected void |
Tracer.visitBranch(int pos,
byte[] code,
int offset) |
protected void |
Tracer.visitGoto(int pos,
byte[] code,
int offset) |
protected void |
Tracer.visitJSR(int pos,
byte[] code)
Invoked when the visited instruction is jsr.
|
protected void |
Tracer.visitLookupSwitch(int pos,
byte[] code,
int n,
int pairsPos,
int defaultOffset) |
protected void |
Tracer.visitRET(int pos,
byte[] code)
Invoked when the visited instruction is ret or wide ret.
|
protected void |
Tracer.visitReturn(int pos,
byte[] code) |
protected void |
Tracer.visitTableSwitch(int pos,
byte[] code,
int n,
int offsetPos,
int defaultOffset) |
protected void |
Tracer.visitThrow(int pos,
byte[] code) |
Modifier and Type | Method and Description |
---|---|
private Frame |
TransformAccessArrayField.getFrame(int pos) |
private java.lang.String |
TransformAccessArrayField.getLoadReplacementSignature(int opcode) |
private java.lang.String |
TransformAccessArrayField.getStoreReplacementSignature(int opcode) |
private java.lang.String |
TransformAccessArrayField.getTopType(int pos) |
private void |
TransformAccessArrayField.initFrames(CtClass clazz,
MethodInfo minfo) |
protected int |
TransformCall.match(int c,
int pos,
CodeIterator iterator,
int typedesc,
ConstPool cp) |
protected int |
TransformBefore.match(int c,
int pos,
CodeIterator iterator,
int typedesc,
ConstPool cp) |
protected int |
TransformAfter.match2(int pos,
CodeIterator iterator) |
protected int |
TransformBefore.match2(int pos,
CodeIterator iterator) |
private int |
TransformAccessArrayField.replace(ConstPool cp,
CodeIterator iterator,
int pos,
int opcode,
java.lang.String signature) |
abstract int |
Transformer.transform(CtClass clazz,
int pos,
CodeIterator it,
ConstPool cp) |
int |
TransformCall.transform(CtClass clazz,
int pos,
CodeIterator iterator,
ConstPool cp)
Modify INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC and INVOKEVIRTUAL
so that a different method is invoked.
|
int |
TransformReadField.transform(CtClass tclazz,
int pos,
CodeIterator iterator,
ConstPool cp) |
int |
TransformWriteField.transform(CtClass tclazz,
int pos,
CodeIterator iterator,
ConstPool cp) |
int |
TransformAccessArrayField.transform(CtClass tclazz,
int pos,
CodeIterator iterator,
ConstPool cp) |
Modifier and Type | Method and Description |
---|---|
protected void |
Expr.replace0(int pos,
Bytecode bytecode,
int size) |
private void |
NewArray.replace2(java.lang.String statement) |
Modifier and Type | Method and Description |
---|---|
void |
Reflection.rebuildClassFile(ClassFile cf) |