Generated by
JDiff

org.objectweb.asm.tree Documentation Differences

This file contains all the changes in documentation in the package org.objectweb.asm.tree as colored differences. Deletions are shown like this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.

Package org.objectweb.asm.tree

Provides

Provides an ASM class adaptervisitor that constructs a tree representation of the classes it visits. This class adapter can be useful to implement "complex" class manipulation operations, i.e., operations that would be very hard to implement without using a tree representation (such as optimizing the number of local variables used by a method).

However However, this class adapter has a cost: it makes ASM bigger and slower. Indeed it requires more than twenty new classes, and multiplies the time needed to transform a class by almost two (it is almost two times faster to read, "modify" and write a class with a ClassAdapter than with a TreeClassAdapterClassNode). This is why this class adapterpackage is bundled in an optional asm-tree.jar library that is separated from (but requires) the asm.jar library, which contains the core ASM framework. This is also why it is recommanded not to use this class adapter when it is possible.

The root class is the ClassNode, that can be created from scratch or from existing bytecode. For example:

  ClassReader cr = new ClassReader(source);
  ClassNode cn = new ClassNode();
  cr.accept(cn, true);

Now content of ClassNode can be modified and then serialized back into bytecode:

  ClassWriter cw = new ClassWriter(true);
  cn.accept(cw);

Several strategies can be used to construct method code from scratch. The first possibility is to create a MethodNode, and then create and add XXXInsnNode to the instructions list:

MethodNode m = new MethodNode(...);
m.instructions.add(new VarInsnNode(ALOAD, 0));
...

Alternatively, you can use the fact that MethodNode is a MethodVisitor, and use that to create the XXXInsnNode and add them to the instructions list through the standard MethodVisitor interface:

MethodNode m = new MethodNode(...);
m.visitVarInsn(ALOAD, 0);
...

If you cannot generate all the instructions in sequential order, i.e. if you need to keep some pointers in the instruction list to insert some instructions at these places after other instructions have been generated, you can define an InsnListInsnNode pseudo instruction class that will in fact contain an instruction list, will possibly implement the MethodVisitor interface, and whose accept method will call the accept method of all the instructions of its list.

MethodNode m = new MethodNode(...);
m.visitVarInsn(ALOAD, 0);
InsnListInsnNode ptr = new InsnListInsnNode();
m.instructions.add(ptr);
m.visitVarInsn(ALOAD, 1);
ptr.visitXXXInsn(...); // inserts an instruction between ALOAD 0 and ALOAD 1

If you need to insert instructions while iterating over an existing instruction list, you can also use several strategies. The first one is to use a ListIterator over the instruction list, and use its add method to insert instructions:

ListIterator i = m.instructions.listIterator();
while (i.hasNext()) {
    AbstractInsnNode n = (AbstractInsnNode) i.next();
    if (...) {
        i.add(new VarInsnNode(ALOAD, 0));
    }
}

If you want to insert these instructions through the MethodVisitor interface, you can define your own InsnListIterator class, that will implement both the ListIterator and MethodVisitor interface.

Another strategy is to use ListIterator.add to insert InsnListInsnNode pseudo instructions, and then use these inserted pseudo instructions to insert an arbitrary number of instructions at these places.

@since ASM 1.3.33

Class AbstractInsnNode, constructor AbstractInsnNode(int)

Constructs a new AbstractInsnNode object. @param opcode the opcode of the instruction to be constructed.
Class AbstractInsnNode, void accept(MethodVisitor)

Makes the given code visitor visit this instruction. @param cv a code visitor.
Class AbstractInsnNode, int getOpcode()

Returns the opcode of this instruction. @return the opcode of this instruction.

Class ClassNode, constructor ClassNode()

Constructs a new ClassNode object. @param version the class version. @param access the class's access flags (see org.objectweb.asm.Constants). This parameter also indicates if the class is deprecated. @param name the internal name of the class (see getInternalName). @param superName the internal of name of the super class (see getInternalName). For interfaces, the super class is Object. @param interfaces the internal names of the class's interfaces (see getInternalName). May be null. @param sourceFile the name of the source file from which this class was compiled. May be null.
Class ClassNode, void accept(ClassVisitor)

Makes the given class visitor visit this class. @param cv a class visitor.
Class ClassNode, int access

The class's access flags (see org.objectweb.asm.ConstantsOpcodes). This field also indicates if the class is deprecated.
Class ClassNode, List attrs

The non standard attributes of thethis class, field or method. This list is a list of Attribute objects. May be null. @associates org.objectweb.asm.Attribute
Class ClassNode, List fields

The fields of this class. This list is a list of FieldNode objects. @associates org.objectweb.asm.tree.FieldNode
Class ClassNode, List innerClasses

Informations about the inner classes of this class. This list is a list of list of InnerClassNode objects. @associates org.objectweb.asm.tree.InnerClassNode
Class ClassNode, List interfaces

The internal names of the class's interfaces (seesee getInternalName). ThisThis list is a a list of String objects.
Class ClassNode, List methods

The methods of this class. This list is a list of MethodNode objects. @associates org.objectweb.asm.tree.MethodNode
Class ClassNode, String name

The internal name of the class (seesee getInternalName).
Class ClassNode, String superName

The internal of name of the super class (seesee getInternalName). ForFor interfaces, the super class is Object. May be null, but only for the the java.lang.Object class.

Class FieldInsnNode, constructor FieldInsnNode(int, String, String, String)

Constructs a new FieldInsnNode object. @param opcode the opcode of the type instruction to be constructed. This opcode must be GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD. @param owner the internal name of the field's owner class (seesee getInternalName). @param name the field's name. @param desc the field's descriptor (see org.objectweb.asm.Type).
Class FieldInsnNode, void setOpcode(int)

Sets the opcode of this instruction. @param opcode the new instruction opcode. This opcode must be GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD.
Class FieldInsnNode, String desc

The field's descriptor (see org.objectweb.asm.Type).
Class FieldInsnNode, String owner

The internal name of the field's owner class (seesee getInternalName).

Class FieldNode, constructor FieldNode(int, String, String, String, Object)

Constructs a new FieldNode object. @param access the field's access flags (seesee org.objectweb.asm.ConstantsOpcodes). This parameter also indicatesindicates if the if the field is synthetic and/or deprecated. @param name the field's name. @param desc the field's descriptor (see org.objectweb.asm.Type). @param signature the field's Type)signature. @param value the field's initial value. This parameter, which may be null if the field does not have an initial value, mustmust be an be an Integer, a Float, a Long, a Long, a Double or a a String. @param attrs the non standard attributes of the field.
Class FieldNode, void accept(ClassVisitor)

Makes the given class visitor visit this field. @param cv a class visitor.
Class FieldNode, int access

The field's access flags (see org.objectweb.asm.ConstantsOpcodes). This field also indicates if the field is synthetic and/or deprecated.
Class FieldNode, List attrs

The non standard attributes of thethis class, field or method. This list is a list of Attribute objects. May be null. @associates org.objectweb.asm.Attribute
Class FieldNode, String desc

The field's descriptor (see org.objectweb.asm.Type).
Class FieldNode, Object value

The field's initial value. This field, which may be null if the if the field does not have an initial value, must be an Integer, a a Float, a Long, a Double or a String.

Class IincInsnNode, constructor IincInsnNode(int, int)

Constructs a new IincInsnNode node. @param var index of the local variable to be incremented. @param incr increment amount to increment the local variable by.

Class InnerClassNode, constructor InnerClassNode(String, String, String, int)

Constructs a new InnerClassNode object. @param name the internal name of an inner class (seesee getInternalName). @param outerName the internal name of the class to which the inner class belongs (seesee getInternalName). May be null. @param innerName the (simple) name of the inner class inside itsits enclosing enclosing class. May be null for anonymous innerinner classes. @param access the access flags of the inner class as originally declared in the enclosing class.
Class InnerClassNode, void accept(ClassVisitor)

Makes the given class visitor visit this inner class. @param cv a class visitor.
Class InnerClassNode, int access

The access flags of the inner class as originally declared in the enclosing the enclosing class.
Class InnerClassNode, String name

The internal name of an inner class (seesee getInternalName).
Class InnerClassNode, String outerName

The internal name of the class to which the inner class belongs (see getInternalName). May be May be null.

Class InsnNode, constructor InsnNode(int)

Constructs a new InsnNode object. @param opcode the opcode of the instruction to be constructed. ThisThis opcode opcode must be NOP, ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_2, ICONST_3, ICONST_4, ICONST_5, LCONST_0, LCONST_1, FCONST_0, FCONST_1, FCONST_2, DCONST_0, DCONST_1, IALOAD, LALOAD, IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IASTORE, LASTORE, IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, SASTORE, POP, SASTOREPOP2, POP, POP2, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP, IADD, LADD, IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV, DMUL, IDIV, LDIV, FDIV, DDIV, IREM, LREM, FREM, DREM, INEG, LNEG, FNEG, DNEG, FNEG, DNEG, ISHL, LSHL, ISHR, LSHR, IUSHR, LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, LXOR, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B, I2C, I2S, I2B, I2C, I2S, LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IRETURN, LRETURN, IRETURN, LRETURN, FRETURN, DRETURN, ARETURN, RETURN, ARRAYLENGTH, ATHROW, MONITORENTER, or MONITOREXIT.
Class InsnNode, void accept(MethodVisitor)

Makes the given code visitor visit this instruction. @param cvmv a codemethod visitor.

Class IntInsnNode, constructor IntInsnNode(int, int)

Constructs a new IntInsnNode object. @param opcode the opcode of the instruction to be constructed. ThisThis opcode opcode must be BIPUSH, SIPUSH or NEWARRAY. @param operand the operand of the instruction to be constructed.
Class IntInsnNode, void setOpcode(int)

Sets the opcode of this instruction. @param opcode the new instruction opcode. This opcode must be BIPUSH, SIPUSH or NEWARRAY.

Class JumpInsnNode, constructor JumpInsnNode(int, Label)

Constructs a new JumpInsnNode object. @param opcode the opcode of the type instruction to be constructed. This opcode must be 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. @param label the operand of the instruction to be constructed. ThisThis operand operand is a label that designates the instruction to which thethe jump jump instruction may jump.
Class JumpInsnNode, void setOpcode(int)

Sets the opcode of this instruction. @param opcode the new instruction opcode. This opcode must be be IFEQ, IFNE, IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, GOTO, JSR, IFNULL or IFNONNULL.

Class LdcInsnNode, constructor LdcInsnNode(Object)

Constructs a new LdcInsnNode object. @param cst the constant to be loaded on the stack. This parameter must be a non null Integer, a Float, a Long, aa Double or a String.
Class LdcInsnNode, Object cst

The constant to be loaded on the stack. This parameter must be a non null Integer, a Float, a a Long, a Double, aa String or a org.objectweb.asm.Type.

Class LineNumberNode, constructor LineNumberNode(int, Label)

Constructs a new LineNumberNode object. @param line a line number. This number refers to the source file file from from which the class was compiled. @param start the first instruction corresponding to this line number.
Class LineNumberNode, void accept(MethodVisitor)

Makes the given code visitor visit this line number declaration. @param cvmv a codemethod visitor.

Class LocalVariableNode, constructor LocalVariableNode(String, String, String, Label, Label, int)

Constructs a new LocalVariableNode object. @param name the name of a local variable. @param desc the type descriptor of this local variable. @param signature the signature of this local variable. May be null. @param start the first instruction corresponding to the scope of this local variable (inclusive). @param end the last instruction corresponding to the scope of this this local local variable (exclusive). @param index the local variable's index.
Class LocalVariableNode, void accept(MethodVisitor)

Makes the given code visitor visit this local variable declaration. @param cvmv a codemethod visitor.

Class LookupSwitchInsnNode, constructor LookupSwitchInsnNode(Label, int[], Label[])

Constructs a new LookupSwitchInsnNode object. @param dflt beginning of the default handler block. @param keys the values of the keys. @param labels beginnings of the handler blocks. labels[i] isis the the beginning of the handler block for the keys[i] key.
Class LookupSwitchInsnNode, List keys

The values of the keys. This list is a list a of Integer objects.
Class LookupSwitchInsnNode, List labels

Beginnings of the handler blocks. This list is a list of Label objects.

Class MethodInsnNode, constructor MethodInsnNode(int, String, String, String)

Constructs a new MethodInsnNode object. @param opcode the opcode of the type instruction to be constructed. This opcode must be INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE. @param owner the internal name of the method's owner class (seesee getInternalName). @param name the method's name. @param desc the method's descriptor (see org.objectweb.asm.Type).
Class MethodInsnNode, void setOpcode(int)

Sets the opcode of this instruction. @param opcode the new instruction opcode. This opcode must be INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.
Class MethodInsnNode, String desc

The method's descriptor (see org.objectweb.asm.Type).
Class MethodInsnNode, String owner

The internal name of the method's owner class (seesee getInternalName).

Class MethodNode, constructor MethodNode(int, String, String, String, String[])

Constructs a new MethodNode object. @param access the method's access flags (see org.objectweb.asm.ConstantsOpcodes). ThisThis parameter also indicates if the parameter also indicates if the method is synthetic and/oror deprecated. @param name the method's name. @param desc the method's descriptor (see Type). @param signature the method's signature. May be Type)null. @param exceptions the internal names of the method's exception exception classes classes (see getInternalName). May be null. @parambe attrs the non standard attributes of the methodnull.
Class MethodNode, void accept(ClassVisitor)

Makes the given class visitor visit this method. @param cv a class visitor.
Class MethodNode, int access

The method's access flags (see org.objectweb.asm.ConstantsOpcodes). This This field alsoalso indicates if the method is synthetic and/or deprecated.
Class MethodNode, List attrs

The non standard attributes of thethis class, field or method. This list is a list of Attribute objects. May be null. @associates org.objectweb.asm.Attribute
Class MethodNode, String desc

The method's descriptor (see Type).
Class MethodNode, List exceptions

The internal names of the method's exception classes (see see getInternalName). This list is a a list ofof String objects.
Class MethodNode, List instructions

The instructions of this method. This list is a list ofof AbstractInsnNode andobjects. Label objects@associates org.objectweb.asm.tree.AbstractInsnNode @label instructions
Class MethodNode, List lineNumbers

The line numbers of this method. This list is a list ofof LineNumberNode objects. May be null @associates org.objectweb.asm.tree.LineNumberNode
Class MethodNode, List localVariables

The local variables of this method. This list is a list ofof LocalVariableNode objects. May be null @associates org.objectweb.asm.tree.LocalVariableNode
Class MethodNode, List tryCatchBlocks

The try catch blocks of this method. This list is a list ofof TryCatchBlockNode objects. @associates org.objectweb.asm.tree.TryCatchBlockNode

Class MultiANewArrayInsnNode, constructor MultiANewArrayInsnNode(String, int)

Constructs a new MultiANewArrayInsnNode. object. @param desc an array type descriptor (see org.objectweb.asm.Type). @param dims number of dimensions of the array to allocate.
Class MultiANewArrayInsnNode, String desc

An array type descriptor (see org.objectweb.asm.Type).

Class TableSwitchInsnNode, constructor TableSwitchInsnNode(int, int, Label, Label[])

Constructs a new TableSwitchInsnNode. @param min the minimum key value. @param max the maximum key value. @param dflt beginning of the default handler block. @param labels beginnings of the handler blocks. labels[i] isis the the beginning of the handler block for the min + i key.
Class TableSwitchInsnNode, List labels

Beginnings of the handler blocks. This list is a list of Label objects.

Class TryCatchBlockNode, constructor TryCatchBlockNode(Label, Label, Label, String)

Constructs a new TryCatchBlockNode object. @param start beginning of the exception handler's scope (inclusive). @param end end of the exception handler's scope (exclusive). @param handler beginning of the exception handler's code. @param type internal name of the type of exceptions handled by thethe handler, handler, or null to catch any exceptions (for "finally" blocks).
Class TryCatchBlockNode, void accept(MethodVisitor)

Makes the given code visitor visit this try catch block. @param cvmv a codemethod visitor.

Class TypeInsnNode, constructor TypeInsnNode(int, String)

Constructs a new TypeInsnNode object. @param opcode the opcode of the type instruction to be constructed. This opcode must be NEW, ANEWARRAY, CHECKCAST or INSTANCEOF. @param desc the operand of the instruction to be constructed. ThisThis operand operand is a type descriptor (see org.objectweb.asm.Type).
Class TypeInsnNode, void setOpcode(int)

Sets the opcode of this instruction. @param opcode the new instruction opcode. This opcode must be be NEW, NEW, ANEWARRAY, CHECKCAST or INSTANCEOF.
Class TypeInsnNode, String desc

The operand of this instruction. This operand is a type descriptor (see org.objectweb.asm.Type).

Class VarInsnNode, constructor VarInsnNode(int, int)

VisitsConstructs a local variablenew instructionVarInsnNode. A local variable instruction is an instruction that loads or stores the value of a local variable. @param opcode the opcode of the local variable instruction to be constructed. This opcode must be ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET. @param var the operand of the instruction to be constructed. This operand is the index of a local variable.
Class VarInsnNode, void setOpcode(int)

Sets the opcode of this instruction. @param opcode the new instruction opcode. This opcode must be ILOAD, LLOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTOREASTORE or RET.