org.mvel2.asm.util
Class Textifier

java.lang.Object
  extended by org.mvel2.asm.util.Printer
      extended by org.mvel2.asm.util.Textifier

public class Textifier
extends Printer

A Printer that prints a disassembled view of the classes it visits.

Author:
Eric Bruneton

Field Summary
static int CLASS_DECLARATION
          Constant used in appendDescriptor for class signatures, formatted in default Java notation (non-bytecode)
static int CLASS_SIGNATURE
          Constant used in appendDescriptor for class signatures, formatted in bytecode notation
static int FIELD_DESCRIPTOR
          Constant used in appendDescriptor for field descriptors, formatted in bytecode notation
static int FIELD_SIGNATURE
          Constant used in appendDescriptor for field signatures, formatted in bytecode notation
static int HANDLE_DESCRIPTOR
          Constant used in appendDescriptor for handle descriptors, formatted in bytecode notation
static int INTERNAL_NAME
          Constant used in appendDescriptor for internal type names in bytecode notation.
protected  Map<Label,String> labelNames
          The label names.
protected  String ltab
          Tab for labels.
static int METHOD_DESCRIPTOR
          Constant used in appendDescriptor for method descriptors, formatted in bytecode notation
static int METHOD_SIGNATURE
          Constant used in appendDescriptor for method signatures, formatted in bytecode notation
static int PARAMETERS_DECLARATION
          Constant used in appendDescriptor for method parameter signatures, formatted in default Java notation (non-bytecode)
protected  String tab
          Tab for class members.
protected  String tab2
          Tab for bytecode instructions.
protected  String tab3
          Tab for table and lookup switch instructions.
static int TYPE_DECLARATION
          Constant used in appendDescriptor for field or method return value signatures, formatted in default Java notation (non-bytecode)
 
Fields inherited from class org.mvel2.asm.util.Printer
api, buf, HANDLE_TAG, OPCODES, text, TYPES
 
Constructor Summary
  Textifier()
          Constructs a new Textifier.
protected Textifier(int api)
          Constructs a new Textifier.
 
Method Summary
protected  void appendDescriptor(int type, String desc)
          Appends an internal name, a type descriptor or a type signature to buf.
protected  void appendHandle(Handle h)
          Appends the information about the given handle to buf.
protected  void appendLabel(Label l)
          Appends the name of the given label to buf.
protected  Textifier createTextifier()
          Creates a new TraceVisitor instance.
static void main(String[] args)
          Prints a disassembled view of 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.
 Textifier visitAnnotation(String desc, boolean visible)
          Prints a disassembled view of the given annotation.
 Textifier visitAnnotation(String name, String desc)
          Nested annotation value.
 Textifier visitAnnotationDefault()
          Method default annotation.
 void visitAnnotationEnd()
          Annotation end.
 Textifier visitArray(String name)
          Annotation array value.
 void visitAttribute(Attribute attr)
          Prints a disassembled view of the given attribute.
 Textifier visitClassAnnotation(String desc, boolean visible)
          Class annotation.
 void visitClassAttribute(Attribute attr)
          Class attribute.
 void visitClassEnd()
          Class end.
 Printer 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 export, int access, String... modules)
           
 Textifier visitField(int access, String name, String desc, String signature, Object value)
          Class field.
 Textifier 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.
 Printer 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.
 Printer 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 visitMainClass(String mainClass)
           
 void visitMaxs(int maxStack, int maxLocals)
          Method max stack and max locals.
 Textifier visitMethod(int access, String name, String desc, String signature, String[] exceptions)
          Class method.
 Textifier 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.
 Printer visitMethodTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
          Method type annotation.
 Printer visitModule(String name, int access, String version)
          Module.
 void visitModuleEnd()
          Module end.
 void visitMultiANewArrayInsn(String desc, int dims)
          Method instruction.
 void visitOpen(String export, int access, String... modules)
           
 void visitOuterClass(String owner, String name, String desc)
          Class outer class.
 void visitPackage(String packaze)
           
 void visitParameter(String name, int access)
          Method parameter.
 Textifier visitParameterAnnotation(int parameter, String desc, boolean visible)
          Method parameter annotation.
 void visitProvide(String provide, String... providers)
           
 void visitRequire(String require, int access, String version)
           
 void visitSource(String file, String debug)
          Class source.
 void visitTableSwitchInsn(int min, int max, Label dflt, Label... labels)
          Method instruction.
 Printer 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.
 Textifier visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible)
          Prints a disassembled view of the given type annotation.
 void visitTypeInsn(int opcode, String type)
          Method instruction.
 void visitUse(String use)
           
 void visitVarInsn(int opcode, int var)
          Method instruction.
 
Methods inherited from class org.mvel2.asm.util.Printer
appendString, getText, print
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERNAL_NAME

public static final int INTERNAL_NAME
Constant used in appendDescriptor for internal type names in bytecode notation.

See Also:
Constant Field Values

FIELD_DESCRIPTOR

public static final int FIELD_DESCRIPTOR
Constant used in appendDescriptor for field descriptors, formatted in bytecode notation

See Also:
Constant Field Values

FIELD_SIGNATURE

public static final int FIELD_SIGNATURE
Constant used in appendDescriptor for field signatures, formatted in bytecode notation

See Also:
Constant Field Values

METHOD_DESCRIPTOR

public static final int METHOD_DESCRIPTOR
Constant used in appendDescriptor for method descriptors, formatted in bytecode notation

See Also:
Constant Field Values

METHOD_SIGNATURE

public static final int METHOD_SIGNATURE
Constant used in appendDescriptor for method signatures, formatted in bytecode notation

See Also:
Constant Field Values

CLASS_SIGNATURE

public static final int CLASS_SIGNATURE
Constant used in appendDescriptor for class signatures, formatted in bytecode notation

See Also:
Constant Field Values

TYPE_DECLARATION

public static final int TYPE_DECLARATION
Constant used in appendDescriptor for field or method return value signatures, formatted in default Java notation (non-bytecode)

See Also:
Constant Field Values

CLASS_DECLARATION

public static final int CLASS_DECLARATION
Constant used in appendDescriptor for class signatures, formatted in default Java notation (non-bytecode)

See Also:
Constant Field Values

PARAMETERS_DECLARATION

public static final int PARAMETERS_DECLARATION
Constant used in appendDescriptor for method parameter signatures, formatted in default Java notation (non-bytecode)

See Also:
Constant Field Values

HANDLE_DESCRIPTOR

public static final int HANDLE_DESCRIPTOR
Constant used in appendDescriptor for handle descriptors, formatted in bytecode notation

See Also:
Constant Field Values

tab

protected String tab
Tab for class members.


tab2

protected String tab2
Tab for bytecode instructions.


tab3

protected String tab3
Tab for table and lookup switch instructions.


ltab

protected String ltab
Tab for labels.


labelNames

protected Map<Label,String> labelNames
The label names. This map associate String values to Label keys.

Constructor Detail

Textifier

public Textifier()
Constructs a new Textifier. Subclasses must not use this constructor. Instead, they must use the Textifier(int) version.

Throws:
IllegalStateException - If a subclass calls this constructor.

Textifier

protected Textifier(int api)
Constructs a new Textifier.

Parameters:
api - the ASM API version implemented by this visitor. Must be one of Opcodes.ASM4, Opcodes.ASM5 or Opcodes.ASM6.
Method Detail

main

public static void main(String[] args)
                 throws Exception
Prints a disassembled view of the given class to the standard output.

Usage: Textifier [-debug] <binary class name or class file name >

Parameters:
args - the command line arguments.
Throws:
Exception - if the class cannot be found, or if an IO exception occurs.

visit

public void visit(int version,
                  int access,
                  String name,
                  String signature,
                  String superName,
                  String[] interfaces)
Description copied from class: Printer
Class header. See org.objectweb.asm.ClassVisitor#visit.

Specified by:
visit in class Printer
Parameters:
version - 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.

visitSource

public void visitSource(String file,
                        String debug)
Description copied from class: Printer
Class source. See org.objectweb.asm.ClassVisitor#visitSource.

Specified by:
visitSource in class Printer
Parameters:
file - 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.

visitModule

public Printer visitModule(String name,
                           int access,
                           String version)
Description copied from class: Printer
Module. See org.objectweb.asm.ClassVisitor#visitModule(String, int).

Overrides:
visitModule in class Printer
Parameters:
name - module name.
access - module flags, among ACC_OPEN, ACC_SYNTHETIC and ACC_MANDATED.
version - module version or null.
Returns:

visitOuterClass

public void visitOuterClass(String owner,
                            String name,
                            String desc)
Description copied from class: Printer
Class outer class. See org.objectweb.asm.ClassVisitor#visitOuterClass. Visits the enclosing class of the class. This method must be called only if the class has an enclosing class.

Specified by:
visitOuterClass in class Printer
Parameters:
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.
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.

visitClassAnnotation

public Textifier visitClassAnnotation(String desc,
                                      boolean visible)
Description copied from class: Printer
Class annotation. See org.objectweb.asm.ClassVisitor#visitAnnotation.

Specified by:
visitClassAnnotation in class Printer
Parameters:
desc - the class descriptor of the annotation class.
visible - true if the annotation is visible at runtime.
Returns:
the printer

visitClassTypeAnnotation

public Printer visitClassTypeAnnotation(int typeRef,
                                        TypePath typePath,
                                        String desc,
                                        boolean visible)
Description copied from class: Printer
Class type annotation. See org.objectweb.asm.ClassVisitor#visitTypeAnnotation.

Overrides:
visitClassTypeAnnotation in class Printer
Parameters:
typeRef - 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 org.objectweb.asm.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.
Returns:
the printer

visitClassAttribute

public void visitClassAttribute(Attribute attr)
Description copied from class: Printer
Class attribute. See org.objectweb.asm.ClassVisitor#visitAttribute.

Specified by:
visitClassAttribute in class Printer
Parameters:
attr - an attribute.

visitInnerClass

public void visitInnerClass(String name,
                            String outerName,
                            String innerName,
                            int access)
Description copied from class: Printer
Class inner name. See org.objectweb.asm.ClassVisitor#visitInnerClass.

Specified by:
visitInnerClass in class Printer
Parameters:
name - 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.

visitField

public Textifier visitField(int access,
                            String name,
                            String desc,
                            String signature,
                            Object value)
Description copied from class: Printer
Class field. See org.objectweb.asm.ClassVisitor#visitField.

Specified by:
visitField in class Printer
Parameters:
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.
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.
Returns:
the printer

visitMethod

public Textifier visitMethod(int access,
                             String name,
                             String desc,
                             String signature,
                             String[] exceptions)
Description copied from class: Printer
Class method. See org.objectweb.asm.ClassVisitor#visitMethod.

Specified by:
visitMethod in class Printer
Parameters:
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.
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.
Returns:
the printer

visitClassEnd

public void visitClassEnd()
Description copied from class: Printer
Class end. See org.objectweb.asm.ClassVisitor#visitEnd.

Specified by:
visitClassEnd in class Printer

visitMainClass

public void visitMainClass(String mainClass)
Overrides:
visitMainClass in class Printer

visitPackage

public void visitPackage(String packaze)
Overrides:
visitPackage in class Printer

visitRequire

public void visitRequire(String require,
                         int access,
                         String version)
Overrides:
visitRequire in class Printer

visitExport

public void visitExport(String export,
                        int access,
                        String... modules)
Overrides:
visitExport in class Printer

visitOpen

public void visitOpen(String export,
                      int access,
                      String... modules)
Overrides:
visitOpen in class Printer

visitUse

public void visitUse(String use)
Overrides:
visitUse in class Printer

visitProvide

public void visitProvide(String provide,
                         String... providers)
Overrides:
visitProvide in class Printer

visitModuleEnd

public void visitModuleEnd()
Description copied from class: Printer
Module end. See org.objectweb.asm.ModuleVisitor#visitEnd.

Overrides:
visitModuleEnd in class Printer

visit

public void visit(String name,
                  Object value)
Description copied from class: Printer
Annotation value. See org.objectweb.asm.AnnotationVisitor#visit.

Specified by:
visit in class Printer
Parameters:
name - the value name.
value - the actual value, whose type must be Byte, Boolean, Character, Short, Integer , Long, Float, Double, String or org.objectweb.asm.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).

visitEnum

public void visitEnum(String name,
                      String desc,
                      String value)
Description copied from class: Printer
Annotation enum value. See org.objectweb.asm.AnnotationVisitor#visitEnum. Visits an enumeration value of the annotation.

Specified by:
visitEnum in class Printer
Parameters:
name - the value name.
desc - the class descriptor of the enumeration class.
value - the actual enumeration value.

visitAnnotation

public Textifier visitAnnotation(String name,
                                 String desc)
Description copied from class: Printer
Nested annotation value. See org.objectweb.asm.AnnotationVisitor#visitAnnotation.

Specified by:
visitAnnotation in class Printer
Parameters:
name - the value name.
desc - the class descriptor of the nested annotation class.
Returns:
the printer

visitArray

public Textifier visitArray(String name)
Description copied from class: Printer
Annotation array value. See org.objectweb.asm.AnnotationVisitor#visitArray. 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 org.objectweb.asm.ClassReader does.

Specified by:
visitArray in class Printer
Parameters:
name - the value name.
Returns:
the printer

visitAnnotationEnd

public void visitAnnotationEnd()
Description copied from class: Printer
Annotation end. See org.objectweb.asm.AnnotationVisitor#visitEnd.

Specified by:
visitAnnotationEnd in class Printer

visitFieldAnnotation

public Textifier visitFieldAnnotation(String desc,
                                      boolean visible)
Description copied from class: Printer
Field annotation. See org.objectweb.asm.FieldVisitor#visitAnnotation.

Specified by:
visitFieldAnnotation in class Printer
Parameters:
desc - the class descriptor of the annotation class.
visible - true if the annotation is visible at runtime.
Returns:
the printer

visitFieldTypeAnnotation

public Printer visitFieldTypeAnnotation(int typeRef,
                                        TypePath typePath,
                                        String desc,
                                        boolean visible)
Description copied from class: Printer
Field type annotation. See org.objectweb.asm.FieldVisitor#visitTypeAnnotation.

Overrides:
visitFieldTypeAnnotation in class Printer
Parameters:
typeRef - a reference to the annotated type. The sort of this type reference must be FIELD. See org.objectweb.asm.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.
Returns:
the printer

visitFieldAttribute

public void visitFieldAttribute(Attribute attr)
Description copied from class: Printer
Field attribute. See org.objectweb.asm.FieldVisitor#visitAttribute.

Specified by:
visitFieldAttribute in class Printer
Parameters:
attr - an attribute.

visitFieldEnd

public void visitFieldEnd()
Description copied from class: Printer
Field end. See org.objectweb.asm.FieldVisitor#visitEnd.

Specified by:
visitFieldEnd in class Printer

visitParameter

public void visitParameter(String name,
                           int access)
Description copied from class: Printer
Method parameter. See org.objectweb.asm.MethodVisitor#visitParameter(String, int).

Overrides:
visitParameter in class Printer
Parameters:
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).

visitAnnotationDefault

public Textifier visitAnnotationDefault()
Description copied from class: Printer
Method default annotation. See org.objectweb.asm.MethodVisitor#visitAnnotationDefault.

Specified by:
visitAnnotationDefault in class Printer
Returns:
the printer

visitMethodAnnotation

public Textifier visitMethodAnnotation(String desc,
                                       boolean visible)
Description copied from class: Printer
Method annotation. See org.objectweb.asm.MethodVisitor#visitAnnotation.

Specified by:
visitMethodAnnotation in class Printer
Parameters:
desc - the class descriptor of the annotation class.
visible - true if the annotation is visible at runtime.
Returns:
the printer

visitMethodTypeAnnotation

public Printer visitMethodTypeAnnotation(int typeRef,
                                         TypePath typePath,
                                         String desc,
                                         boolean visible)
Description copied from class: Printer
Method type annotation. See org.objectweb.asm.MethodVisitor#visitTypeAnnotation.

Overrides:
visitMethodTypeAnnotation in class Printer
Parameters:
typeRef - a reference to the annotated type. The sort of this type reference must be FIELD. See org.objectweb.asm.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.
Returns:
the printer

visitParameterAnnotation

public Textifier visitParameterAnnotation(int parameter,
                                          String desc,
                                          boolean visible)
Description copied from class: Printer
Method parameter annotation. See org.objectweb.asm.MethodVisitor#visitParameterAnnotation.

Specified by:
visitParameterAnnotation in class Printer
Parameters:
parameter - the parameter index.
desc - the class descriptor of the annotation class.
visible - true if the annotation is visible at runtime.
Returns:
the printer

visitMethodAttribute

public void visitMethodAttribute(Attribute attr)
Description copied from class: Printer
Method attribute. See org.objectweb.asm.MethodVisitor#visitAttribute.

Specified by:
visitMethodAttribute in class Printer
Parameters:
attr - an attribute.

visitCode

public void visitCode()
Description copied from class: Printer
Method start. See org.objectweb.asm.MethodVisitor#visitCode.

Specified by:
visitCode in class Printer

visitFrame

public void visitFrame(int type,
                       int nLocal,
                       Object[] local,
                       int nStack,
                       Object[] stack)
Description copied from class: Printer
Method stack frame. See org.objectweb.asm.MethodVisitor#visitFrame. 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.

(*) this is mandatory only for classes whose version is greater than or equal to V1_6.

The frames of a method must be given either in expanded form, or in compressed form (all frames must use the same format, i.e. you must not mix expanded and compressed frames within a single method):
In both cases the first frame, corresponding to the method's parameters and access flags, is implicit and must not be visited. Also, it is illegal to visit two or more frames for the same code location (i.e., at least one instruction must be visited between two calls to visitFrame).

Specified by:
visitFrame in class Printer
Parameters:
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.

visitInsn

public void visitInsn(int opcode)
Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitInsn

Specified by:
visitInsn in class Printer
Parameters:
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.

visitIntInsn

public void visitIntInsn(int opcode,
                         int operand)
Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitIntInsn.

Specified by:
visitIntInsn in class Printer
Parameters:
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.
When opcode is BIPUSH, operand value should be between Byte.MIN_VALUE and Byte.MAX_VALUE.
When opcode is SIPUSH, operand value should be between Short.MIN_VALUE and Short.MAX_VALUE.
When opcode is NEWARRAY, operand value should be one of 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.

visitVarInsn

public void visitVarInsn(int opcode,
                         int var)
Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitVarInsn.

Specified by:
visitVarInsn in class Printer
Parameters:
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.

visitTypeInsn

public void visitTypeInsn(int opcode,
                          String type)
Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitTypeInsn. /** Visits a type instruction. A type instruction is an instruction that takes the internal name of a class as parameter.

Specified by:
visitTypeInsn in class Printer
Parameters:
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 getInternalName).

visitFieldInsn

public void visitFieldInsn(int opcode,
                           String owner,
                           String name,
                           String desc)
Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitFieldInsn.

Specified by:
visitFieldInsn in class Printer
Parameters:
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 getInternalName).
name - the field's name.
desc - the field's descriptor (see Type).

visitMethodInsn

@Deprecated
public void visitMethodInsn(int opcode,
                                       String owner,
                                       String name,
                                       String desc)
Deprecated. 

Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitMethodInsn.

Overrides:
visitMethodInsn in class Printer
Parameters:
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 getInternalName).
name - the method's name.
desc - the method's descriptor (see Type).

visitMethodInsn

public void visitMethodInsn(int opcode,
                            String owner,
                            String name,
                            String desc,
                            boolean itf)
Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitMethodInsn.

Overrides:
visitMethodInsn in class Printer
Parameters:
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 getInternalName).
name - the method's name.
desc - the method's descriptor (see Type).
itf - if the method's owner class is an interface.

visitInvokeDynamicInsn

public void visitInvokeDynamicInsn(String name,
                                   String desc,
                                   Handle bsm,
                                   Object... bsmArgs)
Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitInvokeDynamicInsn. Visits an invokedynamic instruction.

Specified by:
visitInvokeDynamicInsn in class Printer
Parameters:
name - 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, org.objectweb.asm.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.

visitJumpInsn

public void visitJumpInsn(int opcode,
                          Label label)
Description copied from class: Printer
Method jump instruction. See org.objectweb.asm.MethodVisitor#visitJumpInsn.

Specified by:
visitJumpInsn in class Printer
Parameters:
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.

visitLabel

public void visitLabel(Label label)
Description copied from class: Printer
Method label. See org.objectweb.asm.MethodVisitor#visitLabel.

Specified by:
visitLabel in class Printer
Parameters:
label - a Label object.

visitLdcInsn

public void visitLdcInsn(Object cst)
Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitLdcInsn. 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
 }
 

Specified by:
visitLdcInsn in class Printer
Parameters:
cst - 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 org.objectweb.asm.Type of OBJECT or ARRAY sort for .class constants, for classes whose version is 49.0, a org.objectweb.asm.Type of METHOD sort or a Handle for MethodType and MethodHandle constants, for classes whose version is 51.0.

visitIincInsn

public void visitIincInsn(int var,
                          int increment)
Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitIincInsn.

Specified by:
visitIincInsn in class Printer
Parameters:
var - index of the local variable to be incremented.
increment - amount to increment the local variable by.

visitTableSwitchInsn

public void visitTableSwitchInsn(int min,
                                 int max,
                                 Label dflt,
                                 Label... labels)
Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitTableSwitchInsn.

Specified by:
visitTableSwitchInsn in class Printer
Parameters:
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.

visitLookupSwitchInsn

public void visitLookupSwitchInsn(Label dflt,
                                  int[] keys,
                                  Label[] labels)
Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitLookupSwitchInsn.

Specified by:
visitLookupSwitchInsn in class Printer
Parameters:
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.

visitMultiANewArrayInsn

public void visitMultiANewArrayInsn(String desc,
                                    int dims)
Description copied from class: Printer
Method instruction. See org.objectweb.asm.MethodVisitor#visitMultiANewArrayInsn.

Specified by:
visitMultiANewArrayInsn in class Printer
Parameters:
desc - an array type descriptor (see Type).
dims - number of dimensions of the array to allocate.

visitInsnAnnotation

public Printer visitInsnAnnotation(int typeRef,
                                   TypePath typePath,
                                   String desc,
                                   boolean visible)
Description copied from class: Printer
Instruction type annotation. See org.objectweb.asm.MethodVisitor#visitInsnAnnotation.

Overrides:
visitInsnAnnotation in class Printer
Parameters:
typeRef - 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 org.objectweb.asm.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.
Returns:
the printer

visitTryCatchBlock

public void visitTryCatchBlock(Label start,
                               Label end,
                               Label handler,
                               String type)
Description copied from class: Printer
Method exception handler. See org.objectweb.asm.MethodVisitor#visitTryCatchBlock.

Specified by:
visitTryCatchBlock in class Printer
Parameters:
start - 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).

visitTryCatchAnnotation

public Printer visitTryCatchAnnotation(int typeRef,
                                       TypePath typePath,
                                       String desc,
                                       boolean visible)
Description copied from class: Printer
Try catch block type annotation. See org.objectweb.asm.MethodVisitor#visitTryCatchAnnotation.

Overrides:
visitTryCatchAnnotation in class Printer
Parameters:
typeRef - a reference to the annotated type. The sort of this type reference must be EXCEPTION_PARAMETER. See org.objectweb.asm.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.
Returns:
the printer

visitLocalVariable

public void visitLocalVariable(String name,
                               String desc,
                               String signature,
                               Label start,
                               Label end,
                               int index)
Description copied from class: Printer
Method debug info. See org.objectweb.asm.MethodVisitor#visitLocalVariable.

Specified by:
visitLocalVariable in class Printer
Parameters:
name - 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.

visitLocalVariableAnnotation

public Printer visitLocalVariableAnnotation(int typeRef,
                                            TypePath typePath,
                                            Label[] start,
                                            Label[] end,
                                            int[] index,
                                            String desc,
                                            boolean visible)
Description copied from class: Printer
Local variable type annotation. See org.objectweb.asm.MethodVisitor#visitTryCatchAnnotation.

Overrides:
visitLocalVariableAnnotation in class Printer
Parameters:
typeRef - a reference to the annotated type. The sort of this type reference must be LOCAL_VARIABLE or RESOURCE_VARIABLE. See org.objectweb.asm.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.
Returns:
the printer

visitLineNumber

public void visitLineNumber(int line,
                            Label start)
Description copied from class: Printer
Method debug info. See org.objectweb.asm.MethodVisitor#visitLineNumber.

Specified by:
visitLineNumber in class Printer
Parameters:
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.

visitMaxs

public void visitMaxs(int maxStack,
                      int maxLocals)
Description copied from class: Printer
Method max stack and max locals. See org.objectweb.asm.MethodVisitor#visitMaxs.

Specified by:
visitMaxs in class Printer
Parameters:
maxStack - maximum stack size of the method.
maxLocals - maximum number of local variables for the method.

visitMethodEnd

public void visitMethodEnd()
Description copied from class: Printer
Method end. See org.objectweb.asm.MethodVisitor#visitEnd.

Specified by:
visitMethodEnd in class Printer

visitAnnotation

public Textifier visitAnnotation(String desc,
                                 boolean visible)
Prints a disassembled view of the given annotation.

Parameters:
desc - the class descriptor of the annotation class.
visible - true if the annotation is visible at runtime.
Returns:
a visitor to visit the annotation values.

visitTypeAnnotation

public Textifier visitTypeAnnotation(int typeRef,
                                     TypePath typePath,
                                     String desc,
                                     boolean visible)
Prints a disassembled view of the given type annotation.

Parameters:
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.
desc - the class descriptor of the annotation class.
visible - true if the annotation is visible at runtime.
Returns:
a visitor to visit the annotation values.

visitAttribute

public void visitAttribute(Attribute attr)
Prints a disassembled view of the given attribute.

Parameters:
attr - an attribute.

createTextifier

protected Textifier createTextifier()
Creates a new TraceVisitor instance.

Returns:
a new TraceVisitor.

appendDescriptor

protected void appendDescriptor(int type,
                                String desc)
Appends an internal name, a type descriptor or a type signature to buf.

Parameters:
type - indicates if desc is an internal name, a field descriptor, a method descriptor, a class signature, ...
desc - an internal name, type descriptor, or type signature. May be null.

appendLabel

protected void appendLabel(Label l)
Appends the name of the given label to buf. Creates a new label name if the given label does not yet have one.

Parameters:
l - a label.

appendHandle

protected void appendHandle(Handle h)
Appends the information about the given handle to buf.

Parameters:
h - a handle, non null.


Copyright © 2001–2018 JBoss by Red Hat. All rights reserved.