Modifier and Type | Field and Description |
---|---|
static int |
CLASS_DECLARATION
Deprecated.
|
static int |
CLASS_SIGNATURE
The type of class signatures.
|
static int |
FIELD_DESCRIPTOR
The type of field descriptors.
|
static int |
FIELD_SIGNATURE
The type of field signatures.
|
static int |
HANDLE_DESCRIPTOR
The type of method handle descriptors.
|
static int |
INTERNAL_NAME
The type of internal names.
|
protected java.util.Map<org.objectweb.asm.Label,java.lang.String> |
labelNames
The names of the labels.
|
protected java.lang.String |
ltab
The indentation of labels.
|
static int |
METHOD_DESCRIPTOR
The type of method descriptors.
|
static int |
METHOD_SIGNATURE
The type of method signatures.
|
static int |
PARAMETERS_DECLARATION
Deprecated.
|
protected java.lang.String |
tab
The indentation of class members at depth level 1 (e.g. fields, methods).
|
protected java.lang.String |
tab2
The indentation of class elements at depth level 2 (e.g. bytecode instructions in methods).
|
protected java.lang.String |
tab3
The indentation of class elements at depth level 3 (e.g. switch cases in methods).
|
static int |
TYPE_DECLARATION
Deprecated.
|
api, buf, HANDLE_TAG, OPCODES, stringBuilder, text, TYPES
Modifier | Constructor and Description |
---|---|
|
Textifier()
Constructs a new
Textifier . |
protected |
Textifier(int api)
Constructs a new
Textifier . |
Modifier and Type | Method and Description |
---|---|
protected void |
appendDescriptor(int type,
java.lang.String value)
Appends an internal name, a type descriptor or a type signature to
Printer.stringBuilder . |
protected void |
appendHandle(org.objectweb.asm.Handle handle)
Appends a string representation of the given handle to
Printer.stringBuilder . |
protected void |
appendLabel(org.objectweb.asm.Label label)
Appends the name of the given label to
Printer.stringBuilder . |
protected Textifier |
createTextifier()
Creates a new
Textifier . |
static void |
main(java.lang.String[] args)
Prints a disassembled view of the given class to the standard output.
|
void |
visit(int version,
int access,
java.lang.String name,
java.lang.String signature,
java.lang.String superName,
java.lang.String[] interfaces)
Class header.
|
void |
visit(java.lang.String name,
java.lang.Object value)
Annotation value.
|
Textifier |
visitAnnotableParameterCount(int parameterCount,
boolean visible)
Number of method parameters that can have annotations.
|
Textifier |
visitAnnotation(java.lang.String descriptor,
boolean visible)
Prints a disassembled view of the given annotation.
|
Textifier |
visitAnnotation(java.lang.String name,
java.lang.String descriptor)
Nested annotation value.
|
Textifier |
visitAnnotationDefault()
Method default annotation.
|
void |
visitAnnotationEnd()
Annotation end.
|
Textifier |
visitArray(java.lang.String name)
Annotation array value.
|
void |
visitAttribute(org.objectweb.asm.Attribute attribute)
Prints a disassembled view of the given attribute.
|
Textifier |
visitClassAnnotation(java.lang.String descriptor,
boolean visible)
Class annotation.
|
void |
visitClassAttribute(org.objectweb.asm.Attribute attribute)
Class attribute.
|
void |
visitClassEnd()
Class end.
|
Printer |
visitClassTypeAnnotation(int typeRef,
org.objectweb.asm.TypePath typePath,
java.lang.String descriptor,
boolean visible)
Class type annotation.
|
void |
visitCode()
Method start.
|
void |
visitEnum(java.lang.String name,
java.lang.String descriptor,
java.lang.String value)
Annotation enum value.
|
void |
visitExport(java.lang.String export,
int access,
java.lang.String... modules)
Module export.
|
Textifier |
visitField(int access,
java.lang.String name,
java.lang.String descriptor,
java.lang.String signature,
java.lang.Object value)
Class field.
|
Textifier |
visitFieldAnnotation(java.lang.String descriptor,
boolean visible)
Field annotation.
|
void |
visitFieldAttribute(org.objectweb.asm.Attribute attribute)
Field attribute.
|
void |
visitFieldEnd()
Field end.
|
void |
visitFieldInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String descriptor)
Method instruction.
|
Printer |
visitFieldTypeAnnotation(int typeRef,
org.objectweb.asm.TypePath typePath,
java.lang.String descriptor,
boolean visible)
Field type annotation.
|
void |
visitFrame(int type,
int nLocal,
java.lang.Object[] local,
int nStack,
java.lang.Object[] stack)
Method stack frame.
|
void |
visitIincInsn(int var,
int increment)
Method instruction.
|
void |
visitInnerClass(java.lang.String name,
java.lang.String outerName,
java.lang.String innerName,
int access)
Class inner name.
|
void |
visitInsn(int opcode)
Method instruction.
|
Printer |
visitInsnAnnotation(int typeRef,
org.objectweb.asm.TypePath typePath,
java.lang.String descriptor,
boolean visible)
Instruction type annotation.
|
void |
visitIntInsn(int opcode,
int operand)
Method instruction.
|
void |
visitInvokeDynamicInsn(java.lang.String name,
java.lang.String descriptor,
org.objectweb.asm.Handle bootstrapMethodHandle,
java.lang.Object... bootstrapMethodArguments)
Method instruction.
|
void |
visitJumpInsn(int opcode,
org.objectweb.asm.Label label)
Method jump instruction.
|
void |
visitLabel(org.objectweb.asm.Label label)
Method label.
|
void |
visitLdcInsn(java.lang.Object value)
Method instruction.
|
void |
visitLineNumber(int line,
org.objectweb.asm.Label start)
Method debug info.
|
void |
visitLocalVariable(java.lang.String name,
java.lang.String descriptor,
java.lang.String signature,
org.objectweb.asm.Label start,
org.objectweb.asm.Label end,
int index)
Method debug info.
|
Printer |
visitLocalVariableAnnotation(int typeRef,
org.objectweb.asm.TypePath typePath,
org.objectweb.asm.Label[] start,
org.objectweb.asm.Label[] end,
int[] index,
java.lang.String descriptor,
boolean visible)
Local variable type annotation.
|
void |
visitLookupSwitchInsn(org.objectweb.asm.Label dflt,
int[] keys,
org.objectweb.asm.Label[] labels)
Method instruction.
|
void |
visitMainClass(java.lang.String mainClass)
Module main class.
|
void |
visitMaxs(int maxStack,
int maxLocals)
Method max stack and max locals.
|
Textifier |
visitMethod(int access,
java.lang.String name,
java.lang.String descriptor,
java.lang.String signature,
java.lang.String[] exceptions)
Class method.
|
Textifier |
visitMethodAnnotation(java.lang.String descriptor,
boolean visible)
Method annotation.
|
void |
visitMethodAttribute(org.objectweb.asm.Attribute attribute)
Method attribute.
|
void |
visitMethodEnd()
Method end.
|
void |
visitMethodInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String descriptor)
Deprecated.
|
void |
visitMethodInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String descriptor,
boolean isInterface)
Method instruction.
|
Printer |
visitMethodTypeAnnotation(int typeRef,
org.objectweb.asm.TypePath typePath,
java.lang.String descriptor,
boolean visible)
Method type annotation.
|
Printer |
visitModule(java.lang.String name,
int access,
java.lang.String version)
Module.
|
void |
visitModuleEnd()
Module end.
|
void |
visitMultiANewArrayInsn(java.lang.String descriptor,
int numDimensions)
Method instruction.
|
void |
visitOpen(java.lang.String export,
int access,
java.lang.String... modules)
Module open.
|
void |
visitOuterClass(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor)
Class outer class.
|
void |
visitPackage(java.lang.String packaze)
Module package.
|
void |
visitParameter(java.lang.String name,
int access)
Method parameter.
|
Textifier |
visitParameterAnnotation(int parameter,
java.lang.String descriptor,
boolean visible)
Method parameter annotation.
|
void |
visitProvide(java.lang.String provide,
java.lang.String... providers)
Module provide.
|
void |
visitRequire(java.lang.String require,
int access,
java.lang.String version)
Module require.
|
void |
visitSource(java.lang.String file,
java.lang.String debug)
Class source.
|
void |
visitTableSwitchInsn(int min,
int max,
org.objectweb.asm.Label dflt,
org.objectweb.asm.Label... labels)
Method instruction.
|
Printer |
visitTryCatchAnnotation(int typeRef,
org.objectweb.asm.TypePath typePath,
java.lang.String descriptor,
boolean visible)
Try catch block type annotation.
|
void |
visitTryCatchBlock(org.objectweb.asm.Label start,
org.objectweb.asm.Label end,
org.objectweb.asm.Label handler,
java.lang.String type)
Method exception handler.
|
Textifier |
visitTypeAnnotation(int typeRef,
org.objectweb.asm.TypePath typePath,
java.lang.String descriptor,
boolean visible)
Prints a disassembled view of the given type annotation.
|
void |
visitTypeInsn(int opcode,
java.lang.String type)
Method instruction.
|
void |
visitUse(java.lang.String use)
Module use.
|
void |
visitVarInsn(int opcode,
int var)
Method instruction.
|
appendString, appendString, getText, print
public static final int INTERNAL_NAME
appendDescriptor(int, java.lang.String)
.public static final int FIELD_DESCRIPTOR
appendDescriptor(int, java.lang.String)
.public static final int FIELD_SIGNATURE
appendDescriptor(int, java.lang.String)
.public static final int METHOD_DESCRIPTOR
appendDescriptor(int, java.lang.String)
.public static final int METHOD_SIGNATURE
appendDescriptor(int, java.lang.String)
.public static final int CLASS_SIGNATURE
appendDescriptor(int, java.lang.String)
.@Deprecated public static final int TYPE_DECLARATION
@Deprecated public static final int CLASS_DECLARATION
@Deprecated public static final int PARAMETERS_DECLARATION
public static final int HANDLE_DESCRIPTOR
appendDescriptor(int, java.lang.String)
.protected java.lang.String tab
protected java.lang.String tab2
protected java.lang.String tab3
protected java.lang.String ltab
protected java.util.Map<org.objectweb.asm.Label,java.lang.String> labelNames
public Textifier()
Textifier
. Subclasses must not use this constructor. Instead,
they must use the Textifier(int)
version.java.lang.IllegalStateException
- If a subclass calls this constructor.protected Textifier(int api)
Textifier
.api
- the ASM API version implemented by this visitor. Must be one of Opcodes.ASM4
, Opcodes.ASM5
or Opcodes.ASM6
.public static void main(java.lang.String[] args) throws java.io.IOException
Usage: Textifier [-debug] <binary class name or class file name >
args
- the command line arguments.java.io.IOException
- if the class cannot be found, or if an IOException occurs.public void visit(int version, int access, java.lang.String name, java.lang.String signature, java.lang.String superName, java.lang.String[] interfaces)
Printer
ClassVisitor.visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
.visit
in class Printer
version
- the class version. The minor version is stored in the 16 most significant bits,
and the major version in the 16 least significant bits.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 Type.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 Type.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 Type.getInternalName()
). May be null.public void visitSource(java.lang.String file, java.lang.String debug)
Printer
ClassVisitor.visitSource(java.lang.String, java.lang.String)
.visitSource
in class Printer
file
- the name of the source file from which the class was compiled. May be
null.debug
- additional debug information to compute the correspondence between source and
compiled elements of the class. May be null.public Printer visitModule(java.lang.String name, int access, java.lang.String version)
Printer
ClassVisitor.visitModule(java.lang.String, int, java.lang.String)
.visitModule
in class Printer
name
- the fully qualified name (using dots) of the module.access
- the module access flags, among ACC_OPEN
, ACC_SYNTHETIC
and ACC_MANDATED
.version
- the module version, or null.public void visitOuterClass(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
Printer
ClassVisitor.visitOuterClass(java.lang.String, java.lang.String, java.lang.String)
.visitOuterClass
in class Printer
owner
- 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.descriptor
- 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 Textifier visitClassAnnotation(java.lang.String descriptor, boolean visible)
Printer
ClassVisitor.visitAnnotation(java.lang.String, boolean)
.visitClassAnnotation
in class Printer
descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public Printer visitClassTypeAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)
Printer
ClassVisitor.visitTypeAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean)
.visitClassTypeAnnotation
in class Printer
typeRef
- a reference to the annotated type. The sort of this type reference must be
TypeReference.CLASS_TYPE_PARAMETER
, TypeReference.CLASS_TYPE_PARAMETER_BOUND
or TypeReference.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.descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public void visitClassAttribute(org.objectweb.asm.Attribute attribute)
Printer
ClassVisitor.visitAttribute(org.objectweb.asm.Attribute)
.visitClassAttribute
in class Printer
attribute
- an attribute.public void visitInnerClass(java.lang.String name, java.lang.String outerName, java.lang.String innerName, int access)
Printer
ClassVisitor.visitInnerClass(java.lang.String, java.lang.String, java.lang.String, int)
.visitInnerClass
in class Printer
name
- the internal name of an inner class (see Type.getInternalName()
).outerName
- the internal name of the class to which the inner class belongs (see Type.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 Textifier visitField(int access, java.lang.String name, java.lang.String descriptor, java.lang.String signature, java.lang.Object value)
Printer
ClassVisitor.visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object)
.visitField
in class Printer
access
- the field's access flags (see Opcodes
). This parameter also indicates if
the field is synthetic and/or deprecated.name
- the field's name.descriptor
- 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 Textifier visitMethod(int access, java.lang.String name, java.lang.String descriptor, java.lang.String signature, java.lang.String[] exceptions)
Printer
ClassVisitor.visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
.visitMethod
in class Printer
access
- the method's access flags (see Opcodes
). This parameter also indicates if
the method is synthetic and/or deprecated.name
- the method's name.descriptor
- 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 Type.getInternalName()
). May be null.public void visitClassEnd()
Printer
ClassVisitor.visitEnd()
.visitClassEnd
in class Printer
public void visitMainClass(java.lang.String mainClass)
Printer
ModuleVisitor.visitMainClass(java.lang.String)
.visitMainClass
in class Printer
mainClass
- the internal name of the main class of the current module.public void visitPackage(java.lang.String packaze)
Printer
ModuleVisitor.visitPackage(java.lang.String)
.visitPackage
in class Printer
packaze
- the internal name of a package.public void visitRequire(java.lang.String require, int access, java.lang.String version)
Printer
ModuleVisitor.visitRequire(java.lang.String, int, java.lang.String)
.visitRequire
in class Printer
require
- the fully qualified name (using dots) of the dependence.access
- the access flag of the dependence among ACC_TRANSITIVE
, ACC_STATIC_PHASE
, ACC_SYNTHETIC
and ACC_MANDATED
.version
- the module version at compile time, or null.public void visitExport(java.lang.String export, int access, java.lang.String... modules)
Printer
ModuleVisitor.visitExport(java.lang.String, int, java.lang.String...)
.visitExport
in class Printer
export
- the internal name of the exported package.access
- the access flag of the exported package, valid values are among ACC_SYNTHETIC
and ACC_MANDATED
.modules
- the fully qualified names (using dots) of the modules that can access the public
classes of the exported package, or null.public void visitOpen(java.lang.String export, int access, java.lang.String... modules)
Printer
ModuleVisitor.visitOpen(java.lang.String, int, java.lang.String...)
.visitOpen
in class Printer
export
- the internal name of the opened package.access
- the access flag of the opened package, valid values are among ACC_SYNTHETIC
and ACC_MANDATED
.modules
- the fully qualified names (using dots) of the modules that can use deep
reflection to the classes of the open package, or null.public void visitUse(java.lang.String use)
Printer
ModuleVisitor.visitUse(java.lang.String)
.public void visitProvide(java.lang.String provide, java.lang.String... providers)
Printer
ModuleVisitor.visitProvide(java.lang.String, java.lang.String...)
.visitProvide
in class Printer
provide
- the internal name of the service.providers
- the internal names of the implementations of the service (there is at least
one provider).public void visitModuleEnd()
Printer
ModuleVisitor.visitEnd()
.visitModuleEnd
in class Printer
public void visit(java.lang.String name, java.lang.Object value)
Printer
AnnotationVisitor.visit(java.lang.String, java.lang.Object)
.visit
in class Printer
name
- the value name.value
- the actual value, whose type must be Byte
, Boolean
, Character
, Short
, Integer
, Long
, Float
, Double
,
String
or Type
of Type.OBJECT
or Type.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 Printer.visitArray(java.lang.String)
and visiting each array element in turn, but is more convenient).public void visitEnum(java.lang.String name, java.lang.String descriptor, java.lang.String value)
Printer
AnnotationVisitor.visitEnum(java.lang.String, java.lang.String, java.lang.String)
.public Textifier visitAnnotation(java.lang.String name, java.lang.String descriptor)
Printer
AnnotationVisitor.visitAnnotation(java.lang.String, java.lang.String)
.visitAnnotation
in class Printer
name
- the value name.descriptor
- the class descriptor of the nested annotation class.public Textifier visitArray(java.lang.String name)
Printer
AnnotationVisitor.visitArray(java.lang.String)
.visitArray
in class Printer
name
- the value name.public void visitAnnotationEnd()
Printer
AnnotationVisitor.visitEnd()
.visitAnnotationEnd
in class Printer
public Textifier visitFieldAnnotation(java.lang.String descriptor, boolean visible)
Printer
FieldVisitor.visitAnnotation(java.lang.String, boolean)
.visitFieldAnnotation
in class Printer
descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public Printer visitFieldTypeAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)
Printer
FieldVisitor.visitTypeAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean)
.visitFieldTypeAnnotation
in class Printer
typeRef
- a reference to the annotated type. The sort of this type reference must be
TypeReference.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.descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public void visitFieldAttribute(org.objectweb.asm.Attribute attribute)
Printer
FieldVisitor.visitAttribute(org.objectweb.asm.Attribute)
.visitFieldAttribute
in class Printer
attribute
- an attribute.public void visitFieldEnd()
Printer
FieldVisitor.visitEnd()
.visitFieldEnd
in class Printer
public void visitParameter(java.lang.String name, int access)
Printer
MethodVisitor.visitParameter(String, int)
.visitParameter
in class Printer
name
- 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 Textifier visitAnnotationDefault()
Printer
MethodVisitor.visitAnnotationDefault()
.visitAnnotationDefault
in class Printer
public Textifier visitMethodAnnotation(java.lang.String descriptor, boolean visible)
Printer
MethodVisitor.visitAnnotation(java.lang.String, boolean)
.visitMethodAnnotation
in class Printer
descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public Printer visitMethodTypeAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)
Printer
MethodVisitor.visitTypeAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean)
.visitMethodTypeAnnotation
in class Printer
typeRef
- a reference to the annotated type. The sort of this type reference must be
TypeReference.METHOD_TYPE_PARAMETER
, TypeReference.METHOD_TYPE_PARAMETER_BOUND
, TypeReference.METHOD_RETURN
, TypeReference.METHOD_RECEIVER
, TypeReference.METHOD_FORMAL_PARAMETER
or TypeReference.THROWS
. 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.descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public Textifier visitAnnotableParameterCount(int parameterCount, boolean visible)
Printer
MethodVisitor.visitAnnotableParameterCount(int, boolean)
.visitAnnotableParameterCount
in class Printer
parameterCount
- the number of method parameters than can have annotations. This number
must be less or equal than the number of parameter types in the method descriptor. It can
be strictly less when a method has synthetic parameters and when these parameters are
ignored when computing parameter indices for the purpose of parameter annotations (see
https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18).visible
- true to define the number of method parameters that can have
annotations visible at runtime, false to define the number of method parameters
that can have annotations invisible at runtime.public Textifier visitParameterAnnotation(int parameter, java.lang.String descriptor, boolean visible)
Printer
MethodVisitor.visitParameterAnnotation(int, java.lang.String, boolean)
.visitParameterAnnotation
in class Printer
parameter
- the parameter index. This index must be strictly smaller than the number of
parameters in the method descriptor, and strictly smaller than the parameter count
specified in Printer.visitAnnotableParameterCount(int, boolean)
. Important note: a parameter index i
is not required to correspond to the i'th parameter descriptor in the method
descriptor, in particular in case of synthetic parameters (see
https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18).descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public void visitMethodAttribute(org.objectweb.asm.Attribute attribute)
Printer
MethodVisitor.visitAttribute(org.objectweb.asm.Attribute)
.visitMethodAttribute
in class Printer
attribute
- an attribute.public void visitCode()
Printer
MethodVisitor.visitCode()
.public void visitFrame(int type, int nLocal, java.lang.Object[] local, int nStack, java.lang.Object[] stack)
Printer
MethodVisitor.visitFrame(int, int, java.lang.Object[], int, java.lang.Object[])
.visitFrame
in class Printer
type
- 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)
Printer
MethodVisitor.visitInsn(int)
visitInsn
in class Printer
opcode
- 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)
Printer
MethodVisitor.visitIntInsn(int, int)
.visitIntInsn
in class Printer
opcode
- 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)
Printer
MethodVisitor.visitVarInsn(int, int)
.visitVarInsn
in class Printer
opcode
- 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, java.lang.String type)
Printer
MethodVisitor.visitTypeInsn(int, java.lang.String)
.visitTypeInsn
in class Printer
opcode
- 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 Type.getInternalName()
).public void visitFieldInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String descriptor)
Printer
MethodVisitor.visitFieldInsn(int, java.lang.String, java.lang.String, java.lang.String)
.visitFieldInsn
in class Printer
opcode
- 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 Type.getInternalName()
).name
- the field's name.descriptor
- the field's descriptor (see Type
).@Deprecated public void visitMethodInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String descriptor)
Printer
MethodVisitor.visitMethodInsn(int, java.lang.String, java.lang.String, java.lang.String)
.visitMethodInsn
in class Printer
opcode
- 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 Type.getInternalName()
).name
- the method's name.descriptor
- the method's descriptor (see Type
).public void visitMethodInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String descriptor, boolean isInterface)
Printer
MethodVisitor.visitMethodInsn(int, java.lang.String, java.lang.String, java.lang.String)
.visitMethodInsn
in class Printer
opcode
- 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 Type.getInternalName()
).name
- the method's name.descriptor
- the method's descriptor (see Type
).isInterface
- if the method's owner class is an interface.public void visitInvokeDynamicInsn(java.lang.String name, java.lang.String descriptor, org.objectweb.asm.Handle bootstrapMethodHandle, java.lang.Object... bootstrapMethodArguments)
Printer
MethodVisitor.visitInvokeDynamicInsn(java.lang.String, java.lang.String, org.objectweb.asm.Handle, java.lang.Object...)
.visitInvokeDynamicInsn
in class Printer
name
- the method's name.descriptor
- the method's descriptor (see Type
).bootstrapMethodHandle
- the bootstrap method.bootstrapMethodArguments
- 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, org.objectweb.asm.Label label)
Printer
MethodVisitor.visitJumpInsn(int, org.objectweb.asm.Label)
.visitJumpInsn
in class Printer
opcode
- 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(org.objectweb.asm.Label label)
Printer
MethodVisitor.visitLabel(org.objectweb.asm.Label)
.visitLabel
in class Printer
label
- a Label
object.public void visitLdcInsn(java.lang.Object value)
Printer
MethodVisitor.visitLdcInsn(java.lang.Object)
.visitLdcInsn
in class Printer
value
- 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)
Printer
MethodVisitor.visitIincInsn(int, int)
.visitIincInsn
in class Printer
var
- index of the local variable to be incremented.increment
- amount to increment the local variable by.public void visitTableSwitchInsn(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label... labels)
Printer
MethodVisitor.visitTableSwitchInsn(int, int, org.objectweb.asm.Label, org.objectweb.asm.Label...)
.visitTableSwitchInsn
in class Printer
min
- 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(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels)
Printer
MethodVisitor.visitLookupSwitchInsn(org.objectweb.asm.Label, int[], org.objectweb.asm.Label[])
.visitLookupSwitchInsn
in class Printer
dflt
- 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(java.lang.String descriptor, int numDimensions)
Printer
MethodVisitor.visitMultiANewArrayInsn(java.lang.String, int)
.visitMultiANewArrayInsn
in class Printer
descriptor
- an array type descriptor (see Type
).numDimensions
- the number of dimensions of the array to allocate.public Printer visitInsnAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)
Printer
MethodVisitor.visitInsnAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean)
.visitInsnAnnotation
in class Printer
typeRef
- a reference to the annotated type. The sort of this type reference must be
TypeReference.INSTANCEOF
, TypeReference.NEW
, TypeReference.CONSTRUCTOR_REFERENCE
, TypeReference.METHOD_REFERENCE
, TypeReference.CAST
, TypeReference.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
, TypeReference.METHOD_INVOCATION_TYPE_ARGUMENT
, TypeReference.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
, or TypeReference.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.descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public void visitTryCatchBlock(org.objectweb.asm.Label start, org.objectweb.asm.Label end, org.objectweb.asm.Label handler, java.lang.String type)
Printer
MethodVisitor.visitTryCatchBlock(org.objectweb.asm.Label, org.objectweb.asm.Label, org.objectweb.asm.Label, java.lang.String)
.visitTryCatchBlock
in class Printer
start
- the beginning of the exception handler's scope (inclusive).end
- the end of the exception handler's scope (exclusive).handler
- the beginning of the exception handler's code.type
- the internal name of the type of exceptions handled by the handler, or
null to catch any exceptions (for "finally" blocks).public Printer visitTryCatchAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)
Printer
MethodVisitor.visitTryCatchAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean)
.visitTryCatchAnnotation
in class Printer
typeRef
- a reference to the annotated type. The sort of this type reference must be
TypeReference.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.descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public void visitLocalVariable(java.lang.String name, java.lang.String descriptor, java.lang.String signature, org.objectweb.asm.Label start, org.objectweb.asm.Label end, int index)
Printer
MethodVisitor.visitLocalVariable(java.lang.String, java.lang.String, java.lang.String, org.objectweb.asm.Label, org.objectweb.asm.Label, int)
.visitLocalVariable
in class Printer
name
- the name of a local variable.descriptor
- 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, org.objectweb.asm.TypePath typePath, org.objectweb.asm.Label[] start, org.objectweb.asm.Label[] end, int[] index, java.lang.String descriptor, boolean visible)
Printer
MethodVisitor.visitTryCatchAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean)
.visitLocalVariableAnnotation
in class Printer
typeRef
- a reference to the annotated type. The sort of this type reference must be
TypeReference.LOCAL_VARIABLE
or TypeReference.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.descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public void visitLineNumber(int line, org.objectweb.asm.Label start)
Printer
MethodVisitor.visitLineNumber(int, org.objectweb.asm.Label)
.visitLineNumber
in class Printer
line
- 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)
Printer
MethodVisitor.visitMaxs(int, int)
.public void visitMethodEnd()
Printer
MethodVisitor.visitEnd()
.visitMethodEnd
in class Printer
public Textifier visitAnnotation(java.lang.String descriptor, boolean visible)
descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public Textifier visitTypeAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)
typeRef
- a reference to the annotated type. 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.descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public void visitAttribute(org.objectweb.asm.Attribute attribute)
attribute
- an attribute.protected void appendDescriptor(int type, java.lang.String value)
Printer.stringBuilder
.type
- the type of 'value'. Must be one of INTERNAL_NAME
, FIELD_DESCRIPTOR
, FIELD_SIGNATURE
, METHOD_DESCRIPTOR
, METHOD_SIGNATURE
, CLASS_SIGNATURE
, TYPE_DECLARATION
, CLASS_DECLARATION
, PARAMETERS_DECLARATION
of HANDLE_DESCRIPTOR
.value
- an internal name, type descriptor or a type signature. May be null.protected void appendLabel(org.objectweb.asm.Label label)
Printer.stringBuilder
. Constructs a new label name if
the given label does not yet have one.label
- a label.protected void appendHandle(org.objectweb.asm.Handle handle)
Printer.stringBuilder
.handle
- a handle.