|
Generated by JDiff |
||||||||
| PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES | |||||||||
This file contains all the changes in documentation in the packageorg.objectweb.asm.treeas colored differences. Deletions are shownlike 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.
Class AbstractInsnNode, constructor AbstractInsnNode(int)ProvidesProvides 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).
HoweverHowever, 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 aTreeClassAdapterClassNode). This is why thisclass 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 1If 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
Constructs a new AbstractInsnNodeClass AbstractInsnNode, void accept(MethodVisitor)object.@param opcode the opcode of the instruction to be constructed.
Makes the given code visitor visit this instruction.Class AbstractInsnNode, int getOpcode()@param cv a code visitor.
Returns the opcode of this instruction.@return the opcode of this instruction.
Constructs a new ClassNodeClass ClassNode, void accept(ClassVisitor)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.
Makes the given class visitor visit this class.Class ClassNode, int access@param cv a class visitor.
The class's access flags (see org.objectweb.asm.Class ClassNode, List attrsConstantsOpcodes). This field also indicates if the class is deprecated.
The non standard attributes ofClass ClassNode, List fieldsthethis class, field or method. This list is a list of Attribute objects. May be null. @associates org.objectweb.asm.Attribute
The fields of this class. This list is a list ofClass ClassNode, List innerClassesFieldNode objects. @associates org.objectweb.asm.tree.FieldNode
Informations about the inner classes of this class. This list is aClass ClassNode, List interfaceslist oflist of InnerClassNode objects. @associates org.objectweb.asm.tree.InnerClassNode
The internal names of the class's interfaces (Class ClassNode, List methodsseesee getInternalName).ThisThis list isaa list of String objects.
The methods of this class. This list is a list ofClass ClassNode, String nameMethodNode objects. @associates org.objectweb.asm.tree.MethodNode
The internal name of the class (Class ClassNode, String superNameseesee getInternalName).
The internal of name of the super class (seesee getInternalName).ForFor interfaces,the super class is Object. May be null, but only forthethejava.lang.Object class.
Constructs a new FieldInsnNodeClass FieldInsnNode, void setOpcode(int)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 (seeorg.objectweb.asm.Type).
Sets the opcode of this instruction.Class FieldInsnNode, String desc@param opcode the new instruction opcode. This opcode must be GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD.
The field's descriptor (see org.objectweb.asm.Type).Class FieldInsnNode, String owner
The internal name of the field's owner class (seesee getInternalName).
Constructs a new FieldNodeClass FieldNode, void accept(ClassVisitor)object.@param access the field's access flags (seesee org.objectweb.asm.ConstantsOpcodes). This parameter alsoindicatesindicatesiftheif the field is synthetic and/or deprecated. @param name the field's name. @param desc the field's descriptor (seeorg.objectweb.asm.Type). @param signature the field'sType)signature. @param value the field's initial value. This parameter, which may be null if the field does not have an initial value,mustmustbeanbe an Integer, a Float, a Long, aLong,aDouble oraa String.@param attrs the non standard attributes of the field.
Makes the given class visitor visit this field.Class FieldNode, int access@param cv a class visitor.
The field's access flags (see org.objectweb.asm.Class FieldNode, List attrsConstantsOpcodes). This field also indicates if the field is synthetic and/or deprecated.
The non standard attributes ofClass FieldNode, String descthethis class, field or method. This list is a list of Attribute objects. May be null. @associates org.objectweb.asm.Attribute
The field's descriptor (see org.objectweb.asm.Type).Class FieldNode, Object value
The field's initial value. This field, which may be nullif theif the field does not have an initial value, must be anInteger,aa Float, a Long,a Double or a String.
Constructs a new IincInsnNodenode.@param var index of the local variable to be incremented. @param incr increment amount to increment the local variable by.
Constructs a new InnerClassNodeClass InnerClassNode, void accept(ClassVisitor)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 insideitsitsenclosingenclosing class. May be null for anonymousinnerinner classes. @param access the access flags of the inner class as originally declared in the enclosing class.
Makes the given class visitor visit this inner class.Class InnerClassNode, int access@param cv a class visitor.
The access flags of the inner class as originally declared inClass InnerClassNode, String namethe enclosingthe enclosing class.
The internal name of an inner class (Class InnerClassNode, String outerNameseesee getInternalName).
The internal name of the class to which the inner class belongs (see getInternalName).May beMay be null.
Constructs a new InsnNodeClass InsnNode, void accept(MethodVisitor)object.@param opcode the opcode of the instruction to be constructed.ThisThisopcodeopcode 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.
Makes the givencodevisitor visit this instruction. @paramcvmv acodemethod visitor.
Constructs a new IntInsnNodeClass IntInsnNode, void setOpcode(int)object.@param opcode the opcode of the instruction to be constructed.ThisThisopcodeopcode must be BIPUSH, SIPUSH or NEWARRAY. @param operand the operand of the instruction to be constructed.
Sets the opcode of this instruction.@param opcode the new instruction opcode. This opcode must be BIPUSH, SIPUSH or NEWARRAY.
Constructs a new JumpInsnNodeClass JumpInsnNode, void setOpcode(int)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.ThisThisoperandoperand is a label that designates the instruction to whichthethejumpjump instruction may jump.
Sets the opcode of this instruction.@param opcode the new instruction opcode. This opcode mustbebe 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.
Constructs a new LdcInsnNodeClass LdcInsnNode, Object cstobject.@param cst the constant to be loaded on the stack. This parameter must be a non null Integer, aFloat, a Long,aa Double or a String.
The constant to be loaded on the stack. This parameter must be a non null Integer, a Float,aa Long, a Double,aa String or a org.objectweb.asm.Type.
Constructs a new LineNumberNodeClass LineNumberNode, void accept(MethodVisitor)object.@param line a line number. This number refers to the sourcefilefile fromfromwhich the class was compiled. @param start the first instruction corresponding to this line number.
Makes the givencodevisitor visit this line number declaration.@paramcvmv acodemethod visitor.
Constructs a new LocalVariableNodeClass LocalVariableNode, void accept(MethodVisitor)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 ofthisthis locallocalvariable (exclusive). @param index the local variable's index.
Makes the givencodevisitor visit this local variable declaration.@paramcvmv acodemethod visitor.
Constructs a new LookupSwitchInsnNodeClass LookupSwitchInsnNode, List keysobject.@param dflt beginning of the default handler block. @param keys the values of the keys. @param labels beginnings of the handler blocks. labels[i]isisthethe beginning of the handler block for the keys[i] key.
The values of the keys. This list is a listClass LookupSwitchInsnNode, List labelsaofInteger objects.
Beginnings of the handler blocks. This list is a list ofLabel objects.
Constructs a new MethodInsnNodeClass MethodInsnNode, void setOpcode(int)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 (seeorg.objectweb.asm.Type).
Sets the opcode of this instruction.Class MethodInsnNode, String desc@param opcode the new instruction opcode. This opcode must be INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.
The method's descriptor (see org.objectweb.asm.Type).Class MethodInsnNode, String owner
The internal name of the method's owner class (seesee getInternalName).
Constructs a new MethodNodeClass MethodNode, void accept(ClassVisitor)object.@param access the method's access flags (seeorg.objectweb.asm.ConstantsOpcodes).ThisThisparameteralsoindicatesiftheparameter 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 beType)null. @param exceptions the internal names of the method'sexceptionexception classesclasses(seegetInternalName). Maybe null. @parambeattrsthenonstandardattributesofthemethodnull.
Makes the given class visitor visit this method.Class MethodNode, int access@param cv a class visitor.
The method's access flags (seeClass MethodNode, List attrsorg.objectweb.asm.ConstantsOpcodes).ThisThis fieldalsoalso indicates if the method is synthetic and/or deprecated.
The non standard attributes ofClass MethodNode, String descthethis class, field or method. This list is a list of Attribute objects. May be null. @associates org.objectweb.asm.Attribute
The method's descriptor (see Type).Class MethodNode, List exceptions
The internal names of the method's exception classes (Class MethodNode, List instructionsseesee getInternalName). This list isaa listofof String objects.
The instructions of this method. This list is a listClass MethodNode, List lineNumbersofof AbstractInsnNodeandobjects.Labelobjects@associates org.objectweb.asm.tree.AbstractInsnNode @label instructions
The line numbers of this method. This list is a listClass MethodNode, List localVariablesofof LineNumberNode objects. May be null @associates org.objectweb.asm.tree.LineNumberNode
The local variables of this method. This list is a listClass MethodNode, List tryCatchBlocksofof LocalVariableNode objects. May be null @associates org.objectweb.asm.tree.LocalVariableNode
The try catch blocks of this method. This list is a listofof TryCatchBlockNode objects. @associates org.objectweb.asm.tree.TryCatchBlockNode
Constructs a new MultiANewArrayInsnNode.Class MultiANewArrayInsnNode, String descobject.@param desc an array type descriptor (seeorg.objectweb.asm.Type). @param dims number of dimensions of the array to allocate.
An array type descriptor (see org.objectweb.asm.Type).
Constructs a new TableSwitchInsnNode.Class TableSwitchInsnNode, List labels@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]isisthethe beginning of the handler block for the min + i key.
Beginnings of the handler blocks. This list is a list ofLabel objects.
Constructs a new TryCatchBlockNodeClass TryCatchBlockNode, void accept(MethodVisitor)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 bythethehandler,handler, or null to catch any exceptions (for "finally" blocks).
Makes the givencodevisitor visit this try catch block.@paramcvmv acodemethod visitor.
Constructs a new TypeInsnNodeClass TypeInsnNode, void setOpcode(int)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.ThisThisoperandoperand is a type descriptor (see org.objectweb.asm.Type).
Sets the opcode of this instruction.Class TypeInsnNode, String desc@param opcode the new instruction opcode. This opcode mustbebe NEW,NEW,ANEWARRAY, CHECKCAST or INSTANCEOF.
The operand of this instruction. This operand is a type descriptor (see org.objectweb.asm.Type).
Class VarInsnNode, void setOpcode(int)VisitsConstructs alocal variablenewinstructionVarInsnNode.A local variable instruction is an instruction that loads or stores the value of a localvariable.@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.
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.