public final class CodeBuilder
extends org.objectweb.asm.MethodVisitor
MethodVisitor that acts as a substitute for GeneratorAdapter.
GeneratorAdapter has lots of convenient methods (like GeneratorAdapter.push(int)), however it is a subtype of LocalVariablesSorter which
automatically renumbers local variables. This is actually fine (i think), but the problem is that
it makes our debugging information (like ClassData#toString() or BytecodeProducer.trace()) very misleading since none of the local variable indices in the debug
information match the indexes in the generated code, so the debug data just looks wrong.
So instead we use forwarding to reuse the safe subset of the GeneratorAdapter api and
this allows us to skip past all the local variable munging.
| Constructor and Description |
|---|
CodeBuilder(int access,
org.objectweb.asm.commons.Method method,
org.objectweb.asm.MethodVisitor mv) |
CodeBuilder(int access,
org.objectweb.asm.commons.Method method,
org.objectweb.asm.Type[] exceptions,
org.objectweb.asm.ClassVisitor cv) |
CodeBuilder(org.objectweb.asm.MethodVisitor mv,
int access,
String name,
String desc) |
| Modifier and Type | Method and Description |
|---|---|
void |
arrayLength()
See
GeneratorAdapter.arrayLength() |
void |
arrayStore(org.objectweb.asm.Type type)
See
GeneratorAdapter.swap() |
void |
box(org.objectweb.asm.Type type)
See
GeneratorAdapter.box(Type) |
void |
cast(org.objectweb.asm.Type from,
org.objectweb.asm.Type to)
See
GeneratorAdapter.cast(org.objectweb.asm.Type, org.objectweb.asm.Type) |
void |
checkCast(org.objectweb.asm.Type type)
See
GeneratorAdapter.checkCast(Type) |
void |
dup()
See
GeneratorAdapter.dup() |
void |
dup2()
See
GeneratorAdapter.dup2() |
void |
dup2X1()
See
GeneratorAdapter.dup2X1() |
void |
dup2X2()
See
GeneratorAdapter.dup2X2() |
void |
dupX1()
See
GeneratorAdapter.dupX1() |
void |
dupX2()
See
GeneratorAdapter.dupX2() |
void |
endMethod()
See
GeneratorAdapter.endMethod() |
void |
getField(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type type)
See
GeneratorAdapter.getField(Type, String, Type) |
void |
getStatic(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type type)
See
GeneratorAdapter.getStatic(Type, String, Type) |
void |
goTo(org.objectweb.asm.Label label)
See
GeneratorAdapter.goTo(Label) |
void |
ifCmp(org.objectweb.asm.Type type,
int mode,
org.objectweb.asm.Label label)
See
GeneratorAdapter.ifCmp(org.objectweb.asm.Type, int, org.objectweb.asm.Label) |
void |
ifICmp(int mode,
org.objectweb.asm.Label label)
See
GeneratorAdapter.ifICmp(int, Label) |
void |
ifNonNull(org.objectweb.asm.Label label)
See
GeneratorAdapter.ifNonNull(Label) |
void |
ifNull(org.objectweb.asm.Label label)
See
GeneratorAdapter.ifNull(Label) |
void |
ifZCmp(int mode,
org.objectweb.asm.Label label)
See
GeneratorAdapter.ifZCmp(int, Label) |
void |
iinc(int local,
int amount)
See
GeneratorAdapter.iinc(int, int) |
void |
invokeConstructor(org.objectweb.asm.Type type,
org.objectweb.asm.commons.Method method)
See
GeneratorAdapter.invokeConstructor(Type, Method) |
void |
invokeVirtual(org.objectweb.asm.Type owner,
org.objectweb.asm.commons.Method method)
See
GeneratorAdapter.invokeVirtual(Type, Method) |
void |
loadArgs()
See
GeneratorAdapter.loadArgs() |
void |
loadThis()
See
GeneratorAdapter.loadThis() |
org.objectweb.asm.Label |
mark()
See
GeneratorAdapter.mark() |
void |
mark(org.objectweb.asm.Label label)
See
GeneratorAdapter.mark(Label) |
void |
newArray(org.objectweb.asm.Type type)
See
GeneratorAdapter.newArray(Type) |
void |
newInstance(org.objectweb.asm.Type type)
See
GeneratorAdapter.newInstance(Type) |
org.objectweb.asm.Label |
newLabel()
See
GeneratorAdapter.newLabel() |
void |
pop()
See
GeneratorAdapter.pop() |
void |
pop2()
See
GeneratorAdapter.pop2() |
void |
pushBoolean(boolean value)
See
GeneratorAdapter.push(boolean) |
void |
pushDouble(double value)
See
GeneratorAdapter.push(double) |
void |
pushFloat(float value)
See
GeneratorAdapter.push(float) |
void |
pushInt(int value)
See
GeneratorAdapter.push(int) |
void |
pushLong(long value)
See
GeneratorAdapter.push(long) |
void |
pushNull()
See
GeneratorAdapter.push(Type) |
void |
pushString(String value)
See
GeneratorAdapter.push(String) |
void |
pushType(org.objectweb.asm.Type value)
See
GeneratorAdapter.push(Type) |
void |
putField(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type type)
See
GeneratorAdapter.putField(Type, String, Type) |
void |
putStatic(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type type)
See
GeneratorAdapter.putStatic(Type, String, Type) |
void |
returnValue()
See
GeneratorAdapter.returnValue() |
void |
swap()
See
GeneratorAdapter.swap() |
void |
tableSwitch(int[] keys,
org.objectweb.asm.commons.TableSwitchGenerator generator)
See
GeneratorAdapter.tableSwitch(int[], TableSwitchGenerator) |
void |
tableSwitch(int[] keys,
org.objectweb.asm.commons.TableSwitchGenerator generator,
boolean useTable)
See
GeneratorAdapter.tableSwitch(int[], TableSwitchGenerator, boolean) |
void |
throwException()
See
GeneratorAdapter.throwException() |
void |
throwException(org.objectweb.asm.Type type,
String msg)
See
GeneratorAdapter.throwException(Type, String) |
void |
unbox(org.objectweb.asm.Type type)
See
GeneratorAdapter.unbox(Type) |
void |
valueOf(org.objectweb.asm.Type type)
See
GeneratorAdapter.valueOf(Type) |
visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitEnd, visitFieldInsn, visitFrame, visitIincInsn, visitInsn, visitInsnAnnotation, visitIntInsn, visitInvokeDynamicInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLocalVariableAnnotation, visitLookupSwitchInsn, visitMaxs, visitMethodInsn, visitMethodInsn, visitMultiANewArrayInsn, visitParameter, visitParameterAnnotation, visitTableSwitchInsn, visitTryCatchAnnotation, visitTryCatchBlock, visitTypeAnnotation, visitTypeInsn, visitVarInsnpublic CodeBuilder(int access,
org.objectweb.asm.commons.Method method,
org.objectweb.asm.MethodVisitor mv)
public CodeBuilder(int access,
org.objectweb.asm.commons.Method method,
@Nullable
org.objectweb.asm.Type[] exceptions,
org.objectweb.asm.ClassVisitor cv)
public void pushBoolean(boolean value)
GeneratorAdapter.push(boolean)public void pushInt(int value)
GeneratorAdapter.push(int)public void pushLong(long value)
GeneratorAdapter.push(long)public void pushFloat(float value)
GeneratorAdapter.push(float)public void pushDouble(double value)
GeneratorAdapter.push(double)public void pushString(String value)
GeneratorAdapter.push(String)public void pushType(org.objectweb.asm.Type value)
GeneratorAdapter.push(Type)public void pushNull()
GeneratorAdapter.push(Type)public void loadThis()
GeneratorAdapter.loadThis()public void loadArgs()
GeneratorAdapter.loadArgs()public void pop()
GeneratorAdapter.pop()public void pop2()
GeneratorAdapter.pop2()public void dup()
GeneratorAdapter.dup()public void dupX1()
GeneratorAdapter.dupX1()public void dupX2()
GeneratorAdapter.dupX2()public void dup2()
GeneratorAdapter.dup2()public void dup2X1()
GeneratorAdapter.dup2X1()public void dup2X2()
GeneratorAdapter.dup2X2()public void iinc(int local,
int amount)
GeneratorAdapter.iinc(int, int)public void cast(org.objectweb.asm.Type from,
org.objectweb.asm.Type to)
GeneratorAdapter.cast(org.objectweb.asm.Type, org.objectweb.asm.Type)public void box(org.objectweb.asm.Type type)
GeneratorAdapter.box(Type)public void valueOf(org.objectweb.asm.Type type)
GeneratorAdapter.valueOf(Type)public void unbox(org.objectweb.asm.Type type)
GeneratorAdapter.unbox(Type)public org.objectweb.asm.Label newLabel()
GeneratorAdapter.newLabel()public void mark(org.objectweb.asm.Label label)
GeneratorAdapter.mark(Label)public org.objectweb.asm.Label mark()
GeneratorAdapter.mark()public void ifCmp(org.objectweb.asm.Type type,
int mode,
org.objectweb.asm.Label label)
GeneratorAdapter.ifCmp(org.objectweb.asm.Type, int, org.objectweb.asm.Label)public void ifICmp(int mode,
org.objectweb.asm.Label label)
GeneratorAdapter.ifICmp(int, Label)public void ifZCmp(int mode,
org.objectweb.asm.Label label)
GeneratorAdapter.ifZCmp(int, Label)public void ifNull(org.objectweb.asm.Label label)
GeneratorAdapter.ifNull(Label)public void ifNonNull(org.objectweb.asm.Label label)
GeneratorAdapter.ifNonNull(Label)public void goTo(org.objectweb.asm.Label label)
GeneratorAdapter.goTo(Label)public void tableSwitch(int[] keys,
org.objectweb.asm.commons.TableSwitchGenerator generator)
GeneratorAdapter.tableSwitch(int[], TableSwitchGenerator)public void tableSwitch(int[] keys,
org.objectweb.asm.commons.TableSwitchGenerator generator,
boolean useTable)
GeneratorAdapter.tableSwitch(int[], TableSwitchGenerator, boolean)public void returnValue()
GeneratorAdapter.returnValue()public void getStatic(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type type)
GeneratorAdapter.getStatic(Type, String, Type)public void getField(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type type)
GeneratorAdapter.getField(Type, String, Type)public void putField(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type type)
GeneratorAdapter.putField(Type, String, Type)public void putStatic(org.objectweb.asm.Type owner,
String name,
org.objectweb.asm.Type type)
GeneratorAdapter.putStatic(Type, String, Type)public void invokeVirtual(org.objectweb.asm.Type owner,
org.objectweb.asm.commons.Method method)
GeneratorAdapter.invokeVirtual(Type, Method)public void invokeConstructor(org.objectweb.asm.Type type,
org.objectweb.asm.commons.Method method)
GeneratorAdapter.invokeConstructor(Type, Method)public void newInstance(org.objectweb.asm.Type type)
GeneratorAdapter.newInstance(Type)public void newArray(org.objectweb.asm.Type type)
GeneratorAdapter.newArray(Type)public void arrayLength()
GeneratorAdapter.arrayLength()public void throwException()
GeneratorAdapter.throwException()public void throwException(org.objectweb.asm.Type type,
String msg)
GeneratorAdapter.throwException(Type, String)public void checkCast(org.objectweb.asm.Type type)
GeneratorAdapter.checkCast(Type)public void endMethod()
GeneratorAdapter.endMethod()public void swap()
GeneratorAdapter.swap()public void arrayStore(org.objectweb.asm.Type type)
GeneratorAdapter.swap()