| 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.
|
void |
visitExport(String packaze,
String... modules) |
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 jump 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.
|
Printer |
visitModule() |
void |
visitModuleEnd()
Module end.
|
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 |
visitProvide(String service,
String impl) |
void |
visitRequire(String module,
int access) |
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 |
visitUse(String service) |
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, Opcodes.ASM5 or Opcodes.ASM6.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)
PrinterClassVisitor.visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]).visit in class Printerversion - the class version.access - the class's access flags (see Opcodes). This parameter
also indicates if the class is deprecated.name - the internal name of the class (see
getInternalName).signature - the signature of this class. May be null if the class
is not a generic one, and does not extend or implement generic
classes or interfaces.superName - the internal of name of the super class (see
getInternalName).
For interfaces, the super class is Object. May be
null, but only for the Object class.interfaces - the internal names of the class's interfaces (see
getInternalName).
May be null.public void visitSource(String file, String debug)
PrinterClassVisitor.visitSource(java.lang.String, java.lang.String).visitSource in class Printerfile - the name of the source file from which the class was compiled.
May be null.debug - additional debug information to compute the correspondance
between source and compiled elements of the class. May be
null.public Printer visitModule()
visitModule in class Printerpublic void visitOuterClass(String owner, String name, String desc)
PrinterClassVisitor.visitOuterClass(java.lang.String, java.lang.String, java.lang.String).
Visits the enclosing class of the class. This method must be called only
if the class has an enclosing class.visitOuterClass in class Printerowner - internal name of the enclosing class of the class.name - the name of the method that contains the class, or
null if the class is not enclosed in a method of its
enclosing class.desc - the descriptor of the method that contains the class, or
null if the class is not enclosed in a method of its
enclosing class.public ASMifier visitClassAnnotation(String desc, boolean visible)
PrinterClassVisitor.visitAnnotation(java.lang.String, boolean).visitClassAnnotation in class Printerdesc - the class descriptor of the annotation class.visible - true if the annotation is visible at runtime.public ASMifier visitClassTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
PrinterClassVisitor.visitTypeAnnotation(int, org.glassfish.hk2.external.org.objectweb.asm.TypePath, java.lang.String, boolean).visitClassTypeAnnotation in class PrintertypeRef - a reference to the annotated type. The sort of this type
reference must be
CLASS_TYPE_PARAMETER,
CLASS_TYPE_PARAMETER_BOUND
or CLASS_EXTENDS.
See TypeReference.typePath - the path to the annotated type argument, wildcard bound, array
element type, or static inner type within 'typeRef'. May be
null if the annotation targets 'typeRef' as a whole.desc - the class descriptor of the annotation class.visible - true if the annotation is visible at runtime.public void visitClassAttribute(Attribute attr)
PrinterClassVisitor.visitAttribute(org.glassfish.hk2.external.org.objectweb.asm.Attribute).visitClassAttribute in class Printerattr - an attribute.public 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 Printername - the internal name of an inner class (see
getInternalName).outerName - the internal name of the class to which the inner class
belongs (see getInternalName).
May be null for not member classes.innerName - the (simple) name of the inner class inside its enclosing
class. May be null for anonymous inner classes.access - the access flags of the inner class as originally declared in
the enclosing class.public 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 Printeraccess - the field's access flags (see Opcodes). This parameter
also indicates if the field is synthetic and/or deprecated.name - the field's name.desc - the field's descriptor (see Type).signature - the field's signature. May be null if the field's
type does not use generic types.value - the field's initial value. This parameter, which may be
null if the field does not have an initial value,
must be an Integer, a Float, a Long, a
Double or a String (for int,
float, long or String fields
respectively). This parameter is only used for static
fields. Its value is ignored for non static fields, which
must be initialized through bytecode instructions in
constructors or methods.public 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 Printeraccess - the method's access flags (see Opcodes). This
parameter also indicates if the method is synthetic and/or
deprecated.name - the method's name.desc - the method's descriptor (see Type).signature - the method's signature. May be null if the method
parameters, return type and exceptions do not use generic
types.exceptions - the internal names of the method's exception classes (see
getInternalName). May be
null.public void visitClassEnd()
PrinterClassVisitor.visitEnd().visitClassEnd in class Printerpublic void visitRequire(String module, int access)
visitRequire in class Printerpublic void visitExport(String packaze, String... modules)
visitExport in class Printerpublic void visitProvide(String service, String impl)
visitProvide in class Printerpublic void visitModuleEnd()
PrinterModuleVisitor.visitEnd().visitModuleEnd in class Printerpublic void visit(String name, Object value)
PrinterAnnotationVisitor.visit(java.lang.String, java.lang.Object).visit in class Printername - the value name.value - the actual value, whose type must be Byte,
Boolean, Character, Short,
Integer , Long, Float, Double,
String or Type
or OBJECT or ARRAY sort.
This value can also be an array of byte, boolean, short, char, int,
long, float or double values (this is equivalent to using
visitArray and visiting each array element
in turn, but is more convenient).public void visitEnum(String name, String desc, String value)
PrinterAnnotationVisitor.visitEnum(java.lang.String, java.lang.String, java.lang.String).
Visits an enumeration value of the annotation.public ASMifier visitAnnotation(String name, String desc)
PrinterAnnotationVisitor.visitAnnotation(java.lang.String, java.lang.String).visitAnnotation in class Printername - the value name.desc - the class descriptor of the nested annotation class.public ASMifier visitArray(String name)
PrinterAnnotationVisitor.visitArray(java.lang.String).
Visits an array value of the annotation. Note that arrays of primitive
types (such as byte, boolean, short, char, int, long, float or double)
can be passed as value to visit. This is what
ClassReader does.visitArray in class Printername - the value name.public void visitAnnotationEnd()
PrinterAnnotationVisitor.visitEnd().visitAnnotationEnd in class Printerpublic ASMifier visitFieldAnnotation(String desc, boolean visible)
PrinterFieldVisitor.visitAnnotation(java.lang.String, boolean).visitFieldAnnotation in class Printerdesc - the class descriptor of the annotation class.visible - true if the annotation is visible at runtime.public ASMifier visitFieldTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
PrinterFieldVisitor.visitTypeAnnotation(int, org.glassfish.hk2.external.org.objectweb.asm.TypePath, java.lang.String, boolean).visitFieldTypeAnnotation in class PrintertypeRef - a reference to the annotated type. The sort of this type
reference must be FIELD.
See TypeReference.typePath - the path to the annotated type argument, wildcard bound, array
element type, or static inner type within 'typeRef'. May be
null if the annotation targets 'typeRef' as a whole.desc - the class descriptor of the annotation class.visible - true if the annotation is visible at runtime.public void visitFieldAttribute(Attribute attr)
PrinterFieldVisitor.visitAttribute(org.glassfish.hk2.external.org.objectweb.asm.Attribute).visitFieldAttribute in class Printerattr - an attribute.public void visitFieldEnd()
PrinterFieldVisitor.visitEnd().visitFieldEnd in class Printerpublic void visitParameter(String parameterName, int access)
PrinterMethodVisitor.visitParameter(String, int).visitParameter in class PrinterparameterName - parameter name or null if none is provided.access - the parameter's access flags, only ACC_FINAL,
ACC_SYNTHETIC or/and ACC_MANDATED are
allowed (see Opcodes).public ASMifier visitAnnotationDefault()
PrinterMethodVisitor.visitAnnotationDefault().visitAnnotationDefault in class Printerpublic ASMifier visitMethodAnnotation(String desc, boolean visible)
PrinterMethodVisitor.visitAnnotation(java.lang.String, boolean).visitMethodAnnotation in class Printerdesc - the class descriptor of the annotation class.visible - true if the annotation is visible at runtime.public ASMifier visitMethodTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
PrinterMethodVisitor.visitTypeAnnotation(int, org.glassfish.hk2.external.org.objectweb.asm.TypePath, java.lang.String, boolean).visitMethodTypeAnnotation in class PrintertypeRef - a reference to the annotated type. The sort of this type
reference must be FIELD.
See TypeReference.typePath - the path to the annotated type argument, wildcard bound, array
element type, or static inner type within 'typeRef'. May be
null if the annotation targets 'typeRef' as a whole.desc - the class descriptor of the annotation class.visible - true if the annotation is visible at runtime.public ASMifier visitParameterAnnotation(int parameter, String desc, boolean visible)
PrinterMethodVisitor.visitParameterAnnotation(int, java.lang.String, boolean).visitParameterAnnotation in class Printerparameter - the parameter index.desc - the class descriptor of the annotation class.visible - true if the annotation is visible at runtime.public void visitMethodAttribute(Attribute attr)
PrinterMethodVisitor.visitAttribute(org.glassfish.hk2.external.org.objectweb.asm.Attribute).visitMethodAttribute in class Printerattr - an attribute.public 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[]).
Visits the current state of the local variables and operand stack
elements. This method must(*) be called just before any
instruction i that follows an unconditional branch instruction
such as GOTO or THROW, that is the target of a jump instruction, or that
starts an exception handler block. The visited types must describe the
values of the local variables and of the operand stack elements just
before i is executed.V1_6. Opcodes.F_SAME representing frame with exactly the same
locals as the previous frame and with the empty stack.Opcodes.F_SAME1 representing frame with exactly the same
locals as the previous frame and with single value on the stack (
nStack is 1 and stack[0] contains value for the
type of the stack item).Opcodes.F_APPEND representing frame with current locals are
the same as the locals in the previous frame, except that additional
locals are defined (nLocal is 1, 2 or 3 and
local elements contains values representing added types).Opcodes.F_CHOP representing frame with current locals are the
same as the locals in the previous frame, except that the last 1-3 locals
are absent and with the empty stack (nLocals is 1, 2 or 3).Opcodes.F_FULL representing complete frame data.visitFrame in class Printertype - the type of this stack map frame. Must be
Opcodes.F_NEW for expanded frames, or
Opcodes.F_FULL, Opcodes.F_APPEND,
Opcodes.F_CHOP, Opcodes.F_SAME or
Opcodes.F_APPEND, Opcodes.F_SAME1 for
compressed frames.nLocal - the number of local variables in the visited frame.local - the local variable types in this frame. This array must not be
modified. Primitive types are represented by
Opcodes.TOP, Opcodes.INTEGER,
Opcodes.FLOAT, Opcodes.LONG,
Opcodes.DOUBLE,Opcodes.NULL or
Opcodes.UNINITIALIZED_THIS (long and double are
represented by a single element). Reference types are
represented by String objects (representing internal names),
and uninitialized types by Label objects (this label
designates the NEW instruction that created this uninitialized
value).nStack - the number of operand stack elements in the visited frame.stack - the operand stack types in this frame. This array must not be
modified. Its content has the same format as the "local"
array.public void visitInsn(int opcode)
PrinterMethodVisitor.visitInsn(int)visitInsn in class Printeropcode - the opcode of the instruction to be visited. This opcode is
either NOP, ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1,
ICONST_2, ICONST_3, ICONST_4, ICONST_5, LCONST_0, LCONST_1,
FCONST_0, FCONST_1, FCONST_2, DCONST_0, DCONST_1, IALOAD,
LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD,
IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE,
SASTORE, POP, POP2, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1,
DUP2_X2, SWAP, IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB,
IMUL, LMUL, FMUL, DMUL, IDIV, LDIV, FDIV, DDIV, IREM, LREM,
FREM, DREM, INEG, LNEG, FNEG, DNEG, ISHL, LSHL, ISHR, LSHR,
IUSHR, LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, I2L, I2F, I2D,
L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B, I2C, I2S,
LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IRETURN, LRETURN, FRETURN,
DRETURN, ARETURN, RETURN, ARRAYLENGTH, ATHROW, MONITORENTER,
or MONITOREXIT.public void visitIntInsn(int opcode,
int operand)
PrinterMethodVisitor.visitIntInsn(int, int).visitIntInsn in class Printeropcode - the opcode of the instruction to be visited. This opcode is
either BIPUSH, SIPUSH or NEWARRAY.operand - the operand of the instruction to be visited.Opcodes.T_BOOLEAN, Opcodes.T_CHAR,
Opcodes.T_FLOAT, Opcodes.T_DOUBLE,
Opcodes.T_BYTE, Opcodes.T_SHORT,
Opcodes.T_INT or Opcodes.T_LONG.public void visitVarInsn(int opcode,
int var)
PrinterMethodVisitor.visitVarInsn(int, int).visitVarInsn in class Printeropcode - the opcode of the local variable instruction to be visited.
This opcode is either ILOAD, LLOAD, FLOAD, DLOAD, ALOAD,
ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET.var - the operand of the instruction to be visited. This operand is
the index of a local variable.public void visitTypeInsn(int opcode,
String type)
PrinterMethodVisitor.visitTypeInsn(int, java.lang.String).
/**
Visits a type instruction. A type instruction is an instruction that
takes the internal name of a class as parameter.visitTypeInsn in class Printeropcode - the opcode of the type instruction to be visited. This opcode
is either NEW, ANEWARRAY, CHECKCAST or INSTANCEOF.type - the operand of the instruction to be visited. This operand
must be the internal name of an object or array class (see
getInternalName).public 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 Printeropcode - the opcode of the type instruction to be visited. This opcode
is either GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD.owner - the internal name of the field's owner class (see
getInternalName).name - the field's name.desc - the field's descriptor (see Type).@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 Printeropcode - the opcode of the type instruction to be visited. This opcode
is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or
INVOKEINTERFACE.owner - the internal name of the method's owner class (see
getInternalName).name - the method's name.desc - the method's descriptor (see Type).public 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 Printeropcode - the opcode of the type instruction to be visited. This opcode
is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or
INVOKEINTERFACE.owner - the internal name of the method's owner class (see
getInternalName).name - the method's name.desc - the method's descriptor (see Type).itf - if the method's owner class is an interface.public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs)
PrinterMethodVisitor.visitInvokeDynamicInsn(java.lang.String, java.lang.String, org.glassfish.hk2.external.org.objectweb.asm.Handle, java.lang.Object...).
Visits an invokedynamic instruction.visitInvokeDynamicInsn in class Printername - the method's name.desc - the method's descriptor (see Type).bsm - the bootstrap method.bsmArgs - the bootstrap method constant arguments. Each argument must be
an Integer, Float, Long,
Double, String, Type or Handle
value. This method is allowed to modify the content of the
array so a caller should expect that this array may change.public void visitJumpInsn(int opcode,
Label label)
PrinterMethodVisitor.visitJumpInsn(int, org.glassfish.hk2.external.org.objectweb.asm.Label).visitJumpInsn in class Printeropcode - the opcode of the type instruction to be visited. This opcode
is either IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ,
IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE,
IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL.label - the operand of the instruction to be visited. This operand is
a label that designates the instruction to which the jump
instruction may jump.public void visitLabel(Label label)
PrinterMethodVisitor.visitLabel(org.glassfish.hk2.external.org.objectweb.asm.Label).visitLabel in class Printerlabel - a Label object.public void visitLdcInsn(Object cst)
PrinterMethodVisitor.visitLdcInsn(java.lang.Object).
Visits a LDC instruction. Note that new constant types may be added in
future versions of the Java Virtual Machine. To easily detect new
constant types, implementations of this method should check for
unexpected constant types, like this:
if (cst instanceof Integer) {
// ...
} else if (cst instanceof Float) {
// ...
} else if (cst instanceof Long) {
// ...
} else if (cst instanceof Double) {
// ...
} else if (cst instanceof String) {
// ...
} else if (cst instanceof Type) {
int sort = ((Type) cst).getSort();
if (sort == Type.OBJECT) {
// ...
} else if (sort == Type.ARRAY) {
// ...
} else if (sort == Type.METHOD) {
// ...
} else {
// throw an exception
}
} else if (cst instanceof Handle) {
// ...
} else {
// throw an exception
}
visitLdcInsn in class Printercst - the constant to be loaded on the stack. This parameter must be
a non null Integer, a Float, a Long, a
Double, a String, a Type
of OBJECT or ARRAY sort for .class constants, for classes whose
version is 49.0, a Type of METHOD sort or a
Handle for MethodType and MethodHandle constants, for
classes whose version is 51.0.public void visitIincInsn(int var,
int increment)
PrinterMethodVisitor.visitIincInsn(int, int).visitIincInsn in class Printervar - index of the local variable to be incremented.increment - amount to increment the local variable by.public void visitTableSwitchInsn(int min,
int max,
Label dflt,
Label... labels)
PrinterMethodVisitor.visitTableSwitchInsn(int, int, org.glassfish.hk2.external.org.objectweb.asm.Label, org.glassfish.hk2.external.org.objectweb.asm.Label...).visitTableSwitchInsn in class Printermin - the minimum key value.max - the maximum key value.dflt - beginning of the default handler block.labels - beginnings of the handler blocks. labels[i] is the
beginning of the handler block for the min + i key.public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels)
PrinterMethodVisitor.visitLookupSwitchInsn(org.glassfish.hk2.external.org.objectweb.asm.Label, int[], org.glassfish.hk2.external.org.objectweb.asm.Label[]).visitLookupSwitchInsn in class Printerdflt - beginning of the default handler block.keys - the values of the keys.labels - beginnings of the handler blocks. labels[i] is the
beginning of the handler block for the keys[i] key.public void visitMultiANewArrayInsn(String desc, int dims)
PrinterMethodVisitor.visitMultiANewArrayInsn(java.lang.String, int).visitMultiANewArrayInsn in class Printerdesc - an array type descriptor (see Type).dims - number of dimensions of the array to allocate.public ASMifier visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
PrinterMethodVisitor.visitInsnAnnotation(int, org.glassfish.hk2.external.org.objectweb.asm.TypePath, java.lang.String, boolean).visitInsnAnnotation in class PrintertypeRef - a reference to the annotated type. The sort of this type
reference must be INSTANCEOF,
NEW,
CONSTRUCTOR_REFERENCE,
METHOD_REFERENCE,
CAST,
CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT,
METHOD_INVOCATION_TYPE_ARGUMENT,
CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
or METHOD_REFERENCE_TYPE_ARGUMENT.
See TypeReference.typePath - the path to the annotated type argument, wildcard bound, array
element type, or static inner type within 'typeRef'. May be
null if the annotation targets 'typeRef' as a whole.desc - the class descriptor of the annotation class.visible - true if the annotation is visible at runtime.public void visitTryCatchBlock(Label start, Label end, Label handler, String type)
PrinterMethodVisitor.visitTryCatchBlock(org.glassfish.hk2.external.org.objectweb.asm.Label, org.glassfish.hk2.external.org.objectweb.asm.Label, org.glassfish.hk2.external.org.objectweb.asm.Label, java.lang.String).visitTryCatchBlock in class Printerstart - beginning of the exception handler's scope (inclusive).end - end of the exception handler's scope (exclusive).handler - beginning of the exception handler's code.type - internal name of the type of exceptions handled by the
handler, or null to catch any exceptions (for
"finally" blocks).public ASMifier visitTryCatchAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
PrinterMethodVisitor.visitTryCatchAnnotation(int, org.glassfish.hk2.external.org.objectweb.asm.TypePath, java.lang.String, boolean).visitTryCatchAnnotation in class PrintertypeRef - a reference to the annotated type. The sort of this type
reference must be EXCEPTION_PARAMETER.
See TypeReference.typePath - the path to the annotated type argument, wildcard bound, array
element type, or static inner type within 'typeRef'. May be
null if the annotation targets 'typeRef' as a whole.desc - the class descriptor of the annotation class.visible - true if the annotation is visible at runtime.public 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.glassfish.hk2.external.org.objectweb.asm.Label, org.glassfish.hk2.external.org.objectweb.asm.Label, int).visitLocalVariable in class Printername - the name of a local variable.desc - the type descriptor of this local variable.signature - the type signature of this local variable. May be
null if the local variable type does not use generic
types.start - the first instruction corresponding to the scope of this local
variable (inclusive).end - the last instruction corresponding to the scope of this local
variable (exclusive).index - the local variable's index.public Printer visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc, boolean visible)
PrinterMethodVisitor.visitTryCatchAnnotation(int, org.glassfish.hk2.external.org.objectweb.asm.TypePath, java.lang.String, boolean).visitLocalVariableAnnotation in class PrintertypeRef - a reference to the annotated type. The sort of this type
reference must be LOCAL_VARIABLE or RESOURCE_VARIABLE.
See TypeReference.typePath - the path to the annotated type argument, wildcard bound, array
element type, or static inner type within 'typeRef'. May be
null if the annotation targets 'typeRef' as a whole.start - the fist instructions corresponding to the continuous ranges
that make the scope of this local variable (inclusive).end - the last instructions corresponding to the continuous ranges
that make the scope of this local variable (exclusive). This
array must have the same size as the 'start' array.index - the local variable's index in each range. This array must have
the same size as the 'start' array.desc - the class descriptor of the annotation class.visible - true if the annotation is visible at runtime.public void visitLineNumber(int line,
Label start)
PrinterMethodVisitor.visitLineNumber(int, org.glassfish.hk2.external.org.objectweb.asm.Label).visitLineNumber in class Printerline - a line number. This number refers to the source file from
which the class was compiled.start - the first instruction corresponding to this line number.public 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.Copyright © 2009-2016 Oracle Corporation. All Rights Reserved.