| Modifier and Type | Field and Description |
|---|---|
protected int |
id
Identifier of the annotation visitor variable in the produced code.
|
protected Map<Label,String> |
labelNames
The label names.
|
protected String |
name
The name of the visitor variable in the produced code.
|
| Modifier | Constructor and Description |
|---|---|
|
ASMifier()
Constructs a new
ASMifier. |
protected |
ASMifier(int api,
String name,
int id)
Constructs a new
ASMifier. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendConstant(Object cst)
Appends a string representation of the given constant to the given
buffer.
|
protected void |
appendLabel(Label l)
Appends the name of the given label to
buf. |
protected ASMifier |
createASMifier(String name,
int id) |
protected void |
declareLabel(Label l)
Appends a declaration of the given label to
buf. |
static void |
main(String[] args)
Prints the ASM source code to generate the given class to the standard
output.
|
void |
visit(int version,
int access,
String name,
String signature,
String superName,
String[] interfaces)
Class header.
|
void |
visit(String name,
Object value)
Annotation value.
|
ASMifier |
visitAnnotation(String desc,
boolean visible) |
ASMifier |
visitAnnotation(String name,
String desc)
Nested annotation value.
|
ASMifier |
visitAnnotationDefault()
Method default annotation.
|
void |
visitAnnotationEnd()
Annotation end.
|
ASMifier |
visitArray(String name)
Annotation array value.
|
void |
visitAttribute(Attribute attr) |
ASMifier |
visitClassAnnotation(String desc,
boolean visible)
Class annotation.
|
void |
visitClassAttribute(Attribute attr)
Class attribute.
|
void |
visitClassEnd()
Class end.
|
ASMifier |
visitClassTypeAnnotation(int typeRef,
TypePath typePath,
String desc,
boolean visible)
Class type annotation.
|
void |
visitCode()
Method start.
|
void |
visitEnum(String name,
String desc,
String value)
Annotation enum value.
|
ASMifier |
visitField(int access,
String name,
String desc,
String signature,
Object value)
Class field.
|
ASMifier |
visitFieldAnnotation(String desc,
boolean visible)
Field annotation.
|
void |
visitFieldAttribute(Attribute attr)
Field attribute.
|
void |
visitFieldEnd()
Field end.
|
void |
visitFieldInsn(int opcode,
String owner,
String name,
String desc)
Method instruction.
|
ASMifier |
visitFieldTypeAnnotation(int typeRef,
TypePath typePath,
String desc,
boolean visible)
Field type annotation.
|
void |
visitFrame(int type,
int nLocal,
Object[] local,
int nStack,
Object[] stack)
Method stack frame.
|
void |
visitIincInsn(int var,
int increment)
Method instruction.
|
void |
visitInnerClass(String name,
String outerName,
String innerName,
int access)
Class inner name.
|
void |
visitInsn(int opcode)
Method instruction.
|
ASMifier |
visitInsnAnnotation(int typeRef,
TypePath typePath,
String desc,
boolean visible)
Instruction type annotation.
|
void |
visitIntInsn(int opcode,
int operand)
Method instruction.
|
void |
visitInvokeDynamicInsn(String name,
String desc,
Handle bsm,
Object... bsmArgs)
Method instruction.
|
void |
visitJumpInsn(int opcode,
Label label)
Method instruction.
|
void |
visitLabel(Label label)
Method label.
|
void |
visitLdcInsn(Object cst)
Method instruction.
|
void |
visitLineNumber(int line,
Label start)
Method debug info.
|
void |
visitLocalVariable(String name,
String desc,
String signature,
Label start,
Label end,
int index)
Method debug info.
|
Printer |
visitLocalVariableAnnotation(int typeRef,
TypePath typePath,
Label[] start,
Label[] end,
int[] index,
String desc,
boolean visible)
Local variable type annotation.
|
void |
visitLookupSwitchInsn(Label dflt,
int[] keys,
Label[] labels)
Method instruction.
|
void |
visitMaxs(int maxStack,
int maxLocals)
Method max stack and max locals.
|
ASMifier |
visitMethod(int access,
String name,
String desc,
String signature,
String[] exceptions)
Class method.
|
ASMifier |
visitMethodAnnotation(String desc,
boolean visible)
Method annotation.
|
void |
visitMethodAttribute(Attribute attr)
Method attribute.
|
void |
visitMethodEnd()
Method end.
|
void |
visitMethodInsn(int opcode,
String owner,
String name,
String desc)
Deprecated.
|
void |
visitMethodInsn(int opcode,
String owner,
String name,
String desc,
boolean itf)
Method instruction.
|
ASMifier |
visitMethodTypeAnnotation(int typeRef,
TypePath typePath,
String desc,
boolean visible)
Method type annotation.
|
void |
visitMultiANewArrayInsn(String desc,
int dims)
Method instruction.
|
void |
visitOuterClass(String owner,
String name,
String desc)
Class outer class.
|
void |
visitParameter(String parameterName,
int access)
Method parameter.
|
ASMifier |
visitParameterAnnotation(int parameter,
String desc,
boolean visible)
Method parameter annotation.
|
void |
visitSource(String file,
String debug)
Class source.
|
void |
visitTableSwitchInsn(int min,
int max,
Label dflt,
Label... labels)
Method instruction.
|
ASMifier |
visitTryCatchAnnotation(int typeRef,
TypePath typePath,
String desc,
boolean visible)
Try catch block type annotation.
|
void |
visitTryCatchBlock(Label start,
Label end,
Label handler,
String type)
Method exception handler.
|
ASMifier |
visitTypeAnnotation(int typeRef,
TypePath typePath,
String desc,
boolean visible) |
ASMifier |
visitTypeAnnotation(String method,
int typeRef,
TypePath typePath,
String desc,
boolean visible) |
void |
visitTypeInsn(int opcode,
String type)
Method instruction.
|
void |
visitVarInsn(int opcode,
int var)
Method instruction.
|
appendString, getText, printprotected final String name
protected final int id
public ASMifier()
ASMifier. Subclasses must not use this
constructor. Instead, they must use the
ASMifier(int, String, int) version.IllegalStateException - If a subclass calls this constructor.protected ASMifier(int api,
String name,
int id)
ASMifier.api - the ASM API version implemented by this class. Must be one of
Opcodes.ASM4 or Opcodes.ASM5.name - the name of the visitor variable in the produced code.id - identifier of the annotation visitor variable in the produced
code.public static void main(String[] args) throws Exception
Usage: ASMifier [-debug] <binary class name or class file name>
args - the command line arguments.Exception - if the class cannot be found, or if an IO exception occurs.public void visit(int version,
int access,
String name,
String signature,
String superName,
String[] interfaces)
Printerpublic void visitSource(String file, String debug)
PrinterClassVisitor.visitSource(java.lang.String, java.lang.String).visitSource in class Printerpublic void visitOuterClass(String owner, String name, String desc)
PrinterClassVisitor.visitOuterClass(java.lang.String, java.lang.String, java.lang.String).visitOuterClass in class Printerpublic ASMifier visitClassAnnotation(String desc, boolean visible)
PrinterClassVisitor.visitAnnotation(java.lang.String, boolean).visitClassAnnotation in class Printerpublic ASMifier visitClassTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
PrinterClassVisitor.visitTypeAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean).visitClassTypeAnnotation in class Printerpublic void visitClassAttribute(Attribute attr)
PrinterClassVisitor.visitAttribute(org.objectweb.asm.Attribute).visitClassAttribute in class Printerpublic void visitInnerClass(String name, String outerName, String innerName, int access)
PrinterClassVisitor.visitInnerClass(java.lang.String, java.lang.String, java.lang.String, int).visitInnerClass in class Printerpublic ASMifier visitField(int access, String name, String desc, String signature, Object value)
PrinterClassVisitor.visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object).visitField in class Printerpublic ASMifier visitMethod(int access, String name, String desc, String signature, String[] exceptions)
PrinterClassVisitor.visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]).visitMethod in class Printerpublic void visitClassEnd()
PrinterClassVisitor.visitEnd().visitClassEnd in class Printerpublic void visit(String name, Object value)
PrinterAnnotationVisitor.visit(java.lang.String, java.lang.Object).public void visitEnum(String name, String desc, String value)
PrinterAnnotationVisitor.visitEnum(java.lang.String, java.lang.String, java.lang.String).public ASMifier visitAnnotation(String name, String desc)
PrinterAnnotationVisitor.visitAnnotation(java.lang.String, java.lang.String).visitAnnotation in class Printerpublic ASMifier visitArray(String name)
PrinterAnnotationVisitor.visitArray(java.lang.String).visitArray in class Printerpublic void visitAnnotationEnd()
PrinterAnnotationVisitor.visitEnd().visitAnnotationEnd in class Printerpublic ASMifier visitFieldAnnotation(String desc, boolean visible)
PrinterFieldVisitor.visitAnnotation(java.lang.String, boolean).visitFieldAnnotation in class Printerpublic ASMifier visitFieldTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
PrinterFieldVisitor.visitTypeAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean).visitFieldTypeAnnotation in class Printerpublic void visitFieldAttribute(Attribute attr)
PrinterFieldVisitor.visitAttribute(org.objectweb.asm.Attribute).visitFieldAttribute in class Printerpublic void visitFieldEnd()
PrinterFieldVisitor.visitEnd().visitFieldEnd in class Printerpublic void visitParameter(String parameterName, int access)
PrinterMethodVisitor.visitParameter(String, int).visitParameter in class Printerpublic ASMifier visitAnnotationDefault()
PrinterMethodVisitor.visitAnnotationDefault().visitAnnotationDefault in class Printerpublic ASMifier visitMethodAnnotation(String desc, boolean visible)
PrinterMethodVisitor.visitAnnotation(java.lang.String, boolean).visitMethodAnnotation in class Printerpublic ASMifier visitMethodTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
PrinterMethodVisitor.visitTypeAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean).visitMethodTypeAnnotation in class Printerpublic ASMifier visitParameterAnnotation(int parameter, String desc, boolean visible)
PrinterMethodVisitor.visitParameterAnnotation(int, java.lang.String, boolean).visitParameterAnnotation in class Printerpublic void visitMethodAttribute(Attribute attr)
PrinterMethodVisitor.visitAttribute(org.objectweb.asm.Attribute).visitMethodAttribute in class Printerpublic void visitCode()
PrinterMethodVisitor.visitCode().public void visitFrame(int type,
int nLocal,
Object[] local,
int nStack,
Object[] stack)
PrinterMethodVisitor.visitFrame(int, int, java.lang.Object[], int, java.lang.Object[]).visitFrame in class Printerpublic void visitInsn(int opcode)
PrinterMethodVisitor.visitInsn(int)
.public void visitIntInsn(int opcode,
int operand)
PrinterMethodVisitor.visitIntInsn(int, int).visitIntInsn in class Printerpublic void visitVarInsn(int opcode,
int var)
PrinterMethodVisitor.visitVarInsn(int, int).visitVarInsn in class Printerpublic void visitTypeInsn(int opcode,
String type)
PrinterMethodVisitor.visitTypeInsn(int, java.lang.String).visitTypeInsn in class Printerpublic void visitFieldInsn(int opcode,
String owner,
String name,
String desc)
PrinterMethodVisitor.visitFieldInsn(int, java.lang.String, java.lang.String, java.lang.String).visitFieldInsn in class Printer@Deprecated public void visitMethodInsn(int opcode, String owner, String name, String desc)
PrinterMethodVisitor.visitMethodInsn(int, java.lang.String, java.lang.String, java.lang.String).visitMethodInsn in class Printerpublic void visitMethodInsn(int opcode,
String owner,
String name,
String desc,
boolean itf)
PrinterMethodVisitor.visitMethodInsn(int, java.lang.String, java.lang.String, java.lang.String).visitMethodInsn in class Printerpublic void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs)
PrinterMethodVisitor.visitInvokeDynamicInsn(java.lang.String, java.lang.String, org.objectweb.asm.Handle, java.lang.Object...).visitInvokeDynamicInsn in class Printerpublic void visitJumpInsn(int opcode,
Label label)
PrinterMethodVisitor.visitJumpInsn(int, org.objectweb.asm.Label).visitJumpInsn in class Printerpublic void visitLabel(Label label)
PrinterMethodVisitor.visitLabel(org.objectweb.asm.Label).visitLabel in class Printerpublic void visitLdcInsn(Object cst)
PrinterMethodVisitor.visitLdcInsn(java.lang.Object).visitLdcInsn in class Printerpublic void visitIincInsn(int var,
int increment)
PrinterMethodVisitor.visitIincInsn(int, int).visitIincInsn in class Printerpublic void visitTableSwitchInsn(int min,
int max,
Label dflt,
Label... labels)
PrinterMethodVisitor.visitTableSwitchInsn(int, int, org.objectweb.asm.Label, org.objectweb.asm.Label...).visitTableSwitchInsn in class Printerpublic void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels)
PrinterMethodVisitor.visitLookupSwitchInsn(org.objectweb.asm.Label, int[], org.objectweb.asm.Label[]).visitLookupSwitchInsn in class Printerpublic void visitMultiANewArrayInsn(String desc, int dims)
PrinterMethodVisitor.visitMultiANewArrayInsn(java.lang.String, int).visitMultiANewArrayInsn in class Printerpublic ASMifier visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
PrinterMethodVisitor.visitInsnAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean).visitInsnAnnotation in class Printerpublic void visitTryCatchBlock(Label start, Label end, Label handler, String type)
PrinterMethodVisitor.visitTryCatchBlock(org.objectweb.asm.Label, org.objectweb.asm.Label, org.objectweb.asm.Label, java.lang.String).visitTryCatchBlock in class Printerpublic ASMifier visitTryCatchAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
PrinterMethodVisitor.visitTryCatchAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean).visitTryCatchAnnotation in class Printerpublic void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index)
PrinterMethodVisitor.visitLocalVariable(java.lang.String, java.lang.String, java.lang.String, org.objectweb.asm.Label, org.objectweb.asm.Label, int).visitLocalVariable in class Printerpublic Printer visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc, boolean visible)
PrinterMethodVisitor.visitTryCatchAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean).visitLocalVariableAnnotation in class Printerpublic void visitLineNumber(int line,
Label start)
PrinterMethodVisitor.visitLineNumber(int, org.objectweb.asm.Label).visitLineNumber in class Printerpublic void visitMaxs(int maxStack,
int maxLocals)
PrinterMethodVisitor.visitMaxs(int, int).public void visitMethodEnd()
PrinterMethodVisitor.visitEnd().visitMethodEnd in class Printerpublic ASMifier visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
public ASMifier visitTypeAnnotation(String method, int typeRef, TypePath typePath, String desc, boolean visible)
public void visitAttribute(Attribute attr)
protected void appendConstant(Object cst)
protected void declareLabel(Label l)
buf. This
declaration is of the form "Label lXXX = new Label();". Does nothing if
the given label has already been declared.l - a label.