|
Generated by JDiff |
||||||||
| PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES | |||||||||
This file contains all the changes in documentation in the packageorg.objectweb.asmas 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.
Provides a small and fast bytecode manipulation framework.Class AttributeThe ASM framework is organized around the ClassVisitor, FieldVisitor and
CodeVisitorMethodVisitor interfaces, whichallowsallow oneone to visitto visit the fields and methods of a class, including the bytecodeinstructionsinstructions ofof eacheach method.In addition to these
twomain interfaces, ASM provides a ClassReader class, that can parse an existing class and make a given visitor visit it. ASM also provides a ClassWriter class, which is a visitor that generates Java class files.In order to generate a class from scratch, only the ClassWriter class is necessary. Indeed, in order to generate a class, one must just call its visitXXX methods with the appropriate arguments to generate the desired fields and methods. See the "helloworld" example in the ASM distribution for more details about class generation.
In order to modify existing classes, one must use a ClassReader class to
analyse theanalyze the original class, a class modifier, and a ClassWriter to construct the modified class. The class modifier is just a ClassVisitor that delegates most of the work to another ClassVisitor, but that sometimes changes some parameter values, or call additional methods, in order to implement the desired modification process. In order to make it easier to implement such class modifiers, ASM provides the ClassAdapter andCodeAdapterMethodAdapter classes, which implement the ClassVisitorandandCodeVisitorMethodVisitor interfaces bydelegating alldelegating all work to other visitors. See the "adapt" example in the ASMdistribution fordistribution for more details about class modification.The size of the core ASM library, asm.jar, is only
25KB31KB, which is much more smaller than the size of the BCEL library (350KB without the class verifier), and than the size of the SERP library (150KB). ASM is also much more faster than these tools. Indeed the overhead of a load time class transformation process is of the order of 60% with ASM, 700% or more with BCEL, and 1100% or more with SERP (see the test/perf directory in the ASM distribution)!kASM is a subset of ASM, for class generation only (it includes the ClassWriter, but not the ClassReader). The size of this library, kasm.jar, is only 16KB.@since ASM 1.3
A non standard class, field, method or code attribute. @author EricClass Attribute, constructor Attribute(String)Bruneton,Bruneton @author Eugene Kuleshov
Constructs a new empty attribute.Class Attribute, Label[] getLabels()@param type the type of the attribute.
Returns the labels corresponding to this attribute.Class Attribute, boolean isUnknown()@return the labels corresponding to this attribute, or null if this attribute is not a code attribute that contains labels.
Returns true if this type of attribute is unknown. The default implementation of this method always returns true. @return true ifClass Attribute, Attribute read(ClassReader, int, int, char[], int, Label[])the classthis type ofthis objectattribute isequal to Attributeunknown.
Reads a type attribute. This method must return a new Attribute object, of type type, correspondingClass Attribute, ByteVector write(ClassWriter, byte[], int, int, int)to theto the len bytes starting at the given offset, in the givenclassclass reader.@param cr the class that contains the attribute to be read. @param off index of the first byte of the attribute's content in cr.b. The 6 attribute header bytes, containingthethetypetype and the length of the attribute, are not taken intoaccountaccount here. @param len the length of the attribute's content. @param buf buffer to be used tocallcall readUTF8, readClassoror readConst. @param codeOff index of the first byte of code's attribute content in cr.b, or -1 if the attribute to be readisisnotanot a code attribute. The 6 attribute header bytes, containingthe typetheandtype and the length of the attribute, are not taken intoaccountaccount here. @param labels the labels of the method's code, or null if the attribute to be read is not a code attribute. @return a new Attribute object corresponding to the given bytes.
Returns the byte array form of this attribute.@param cw the class to which this attribute must be added. This parameter can be used to add to the constant pool of this class theitemsitemsthatthat corresponds to this attribute. @param code the bytecode of the method corresponding to this code attribute, or null if this attribute is not a code attributes. @param len the length of the bytecode of the method corresponding to this code attribute, or null if this attribute is not a code attribute. @param maxStack the maximum stack size of the method correspondingto thisto this code attribute, or -1 if this attribute is not acodecode attribute. @param maxLocals the maximum number of local variables of the method corresponding to this code attribute, or -1 if this attributeisisnotnot a code attribute. @return the byte array form of this attribute.
Constructs a new ByteVector with a defaultClass ByteVector, constructor ByteVector(int)initialinitial size.
Constructs a new ByteVector with the givenClass ByteVector, ByteVector putByte(int)initialinitial size.@param initialSize the initial size of the byte vector to be constructed.
Puts a byte into this byte vector. The byte vector is automatically enlarged if necessary.Class ByteVector, ByteVector putByteArray(byte[], int, int)@param b a byte. @return this byte vector.
Puts an array of bytes into this byte vector. The byte vector is automatically enlarged if necessary.Class ByteVector, ByteVector putInt(int)@param b an array of bytes. May be null to put lennullnull bytes into this byte vector. @param off index of the fist byte of b that must be copied. @param len number of bytes of b that must be copied. @return this byte vector.
Puts an int into this byte vector. The byte vector is automatically enlarged if necessary.Class ByteVector, ByteVector putLong(long)@param i an int. @return this byte vector.
Puts a long into this byte vector. The byte vector is automatically enlarged if necessary.Class ByteVector, ByteVector putShort(int)@param l a long. @return this byte vector.
Puts a short into this byte vector. The byte vector is automatically enlarged if necessary.Class ByteVector, ByteVector putUTF8(String)@param s a short. @return this byte vector.
Puts an UTF8 string into this byte vector. The byte vectoris automaticallyis automatically enlarged if necessary.@param s a String. @return this byte vector.
An empty ClassVisitor that delegates to another ClassVisitor. This class can be used as a super classClass ClassAdapter, constructor ClassAdapter(ClassVisitor)toto quickly implement usefullclassclass adapter classes, just by overridingthethe necessary methods. @author Eric Bruneton
Constructs a new ClassAdapter object.Class ClassAdapter, ClassVisitor cv@param cv the class visitor to which this adapter must delegate calls.
The ClassVisitor to which this adapterdelegatesdelegates calls.
A Java class parser to make a ClassVisitor visitClass ClassReader, constructor ClassReader(InputStream)anan existing class. This class parses a byte array conforming to the Javaclassclass file formatandand calls the appropriate visit methods of a given classvisitorvisitor for each field, method and bytecode instruction encountered. @author EricBrunetonBruneton @author Eugene Kuleshov
Constructs a new ClassReader object.Class ClassReader, constructor ClassReader(String)@param is an input stream from which to read the class. @throws IOException if a problem occurs during reading.
Constructs a new ClassReader object.Class ClassReader, constructor ClassReader(byte[])@param name the fully qualified name of the class to be read. @throws IOException if an exception occurs during reading.
Constructs a new ClassReader object.Class ClassReader, constructor ClassReader(byte[], int, int)@param b the bytecode of the class to be read.
Constructs a new ClassReader object.Class ClassReader, void accept(ClassVisitor, Attribute[], boolean)@param b the bytecode of the class to be read. @param off the start offset of the class data. @param len the length of the class data.
Makes the given visitor visit the Java class of thisClass ClassReader, void accept(ClassVisitor, boolean)ClassReader. This class is the one specified in the constructor (see ClassReader).@param classVisitor the visitor that must visit this class. @param attrs prototypes of the attributes that must be parsed during the visit of the class. Any attribute whose type is not equal tothethetypetype of one the prototypes will be ignored. @param skipDebug true if the debug information of theclassclassmustmust not be visited. In this casethethe visitLocalVariableandand visitLineNumber methodswillwill not be called.
Makes the given visitor visit the Java class of thisClass ClassReader, int getItem(int)ClassReader. This class is the one specified in the constructor (see ClassReader).@param classVisitor the visitor that must visit this class. @param skipDebug true if the debug information of theclassclassmustmust not be visited. In this casethethe visitLocalVariableandand visitLineNumber methodswillwill not be called.
Returns the start index of the constant pool item in b,Class ClassReader, int readByte(int)plusplusone. This method is intended for Attribute sub classes, andisis normally not needed by class generators or adapters. @param item the index a constant pool item. @return the start index of the constant pool item in b,plusplusone.
Reads a byte value in b. This method isClass ClassReader, String readClass(int, char[])intended forintended for Attribute sub classes, and is normally not needed by class generators or adapters.@param index the start index of the value to be read in b. @return the read value.
Reads a class constant pool item in b. This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.Class ClassReader, Object readConst(int, char[])@param index the start index of an unsigned short value in b, whose value is the index of a class constant pool item. @param buf buffer to be used to read the item. This buffer must be sufficiently large. It is not automatically resized. @return the String corresponding to the specified class item.
Reads a numeric or string constant pool item in b. This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.Class ClassReader, int readInt(int)@param item the index of a constant pool item. @param buf buffer to be used to read the item. This buffer must be sufficiently large. It is not automatically resized. @return the Integer,Float, Long,Double,Double, String or Type correspondingtotothegiventhe given constant pool item.
Reads a signed int value in b. This method isClass ClassReader, long readLong(int)intended forintended for Attribute sub classes, and is normally not needed by class generators or adapters.@param index the start index of the value to be read in b. @return the read value.
Reads a signed long value in b. This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.Class ClassReader, short readShort(int)@param index the start index of the value to be read in b. @return the read value.
Reads a signed short value in b. This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.Class ClassReader, String readUTF8(int, char[])@param index the start index of the value to be read in b. @return the read value.
Reads an UTF8 string constant pool item in b. ThisClass ClassReader, int readUnsignedShort(int)method ismethod is intended for Attribute sub classes, and is normally notneededneededbyby class generators or adapters.@param index the start index of an unsigned short value in b, whose value is the index of an UTF8 constant pool item. @param buf buffer to be used to read the item. This buffer must be sufficiently large. It is not automatically resized. @return the String corresponding to the specified UTF8 item.
Reads an unsigned short value in b. This methodClass ClassReader, byte[] bis intendedis intended for Attribute sub classes, and is normally not neededbybyclassclass generators or adapters.@param index the start index of the value to be read in b. @return the read value.
The class to be parsed. The content of this array must not be modified. This field is intended for Attribute sub classes,and isand is normally not needed by class generators or adapters.
A visitor to visit a Java class. The methods of this interface must be called in the following order: visit [ visitSource ] [ visitOuterClass ] (Class ClassVisitor, void visit(int, int, String, String, String, String[])visitFieldvisitAnnotation |visitMethodvisitAttribute|)* (visitInnerClass |visitAttributevisitField | visitMethod )*visitEnd. @author Eric Bruneton
Visits the header of the class.Class ClassVisitor, void visitAttribute(Attribute)@param version the class version. @param access the class's access flags (seeConstantsOpcodes). This parameter also indicates if the class is deprecated. @param name the internal name of the class (seesee getInternalName). @param 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. @param superName the internal of name of the super class (seesee getInternalName). For interfaces,thesuperthe super class is Object. May be null,butbut only for thejava.lang.Object class. @param interfaces the internal names of the class's interfaces (seesee getInternalName). Maybe null. @param sourceFile the name of the source file from which this class wasbecompiled. Maybenull.
Visits a non standard attribute of the class.Class ClassVisitor, FieldVisitor visitField(int, String, String, String, Object)Thismethod must visit only the first attribute in the given attribute list.@param attra non standard classan attribute.Must not be null.
Visits a field of the class.Class ClassVisitor, void visitInnerClass(String, String, String, int)@param access the field's access flags (seeConstantsOpcodes). This parameter also indicates if the field is synthetic and/oror deprecated. @param name the field's name. @param desc the field's descriptor (see Type). @param signature the field's signature. May be null if the field's type does not use generic types. @param value the field's initial value. This parameter, which may be null if the field does not have an initial value,must bemustanbe an Integer, a Float, a Long, aLong,aDouble oraa String (for int, float, longor String fieldsorStringfieldsrespectively). This parameter is onlyused for static fields. Its value is ignored for non staticfields, which must befields,whichmustbeinitialized through bytecode instructions inconstructors orconstructorsormethods. @paramreturnattrs thea visitornonto visit fieldstandard methodannotations and attributes,linkedortogetherbytheirnextnullfield.ifMay bethis classnullvisitor is not interested in visiting these annotations and attributes.
Visits information about an inner class. This inner class is not necessarily a member of the class being visited.Class ClassVisitor, MethodVisitor visitMethod(int, String, String, String, String[])@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 (see getInternalName).MayMaybebe 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.
Visits a method of the class. This method must return a newCodeVisitorMethodVisitor instance (or null) each timeit isit is called, i.e., it should not return a previously returned visitor.@param access the method's access flags (seeConstantsOpcodes). This 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). @paramexceptionssignature theinternalmethod'snamessignature.of theMay be null if the method'sexceptionparameters, return type and exceptions doclassesnot(seeusegetInternalName).genericMaybenulltypes. @paramattrsexceptions thenoninternal namesstandard methodof theattributes,method'slinked togetherexception classesbytheirnext(seefieldgetInternalName). Maybebe null. @return an object to visit the byte code of the method, or nullifif this class visitor is not interested in visiting the codeofofthisthis method.
A ClassVisitor that generatesClass ClassWriter, constructor ClassWriter(boolean)Javaclassesclassin bytecodefilesform. More precisely this visitor generates a byte array conforming to the Java class file format. It can be used alone, to generate a Java class "from scratch", or with one or more ClassReader and adapterclassclassvisitorvisitor to generate a modified class from one or more existing Java classes. @author Eric Bruneton
Constructs a new ClassWriter object.Class ClassWriter, constructor ClassWriter(boolean, boolean)@param computeMaxs true if the maximum stack size andthethemaximummaximum number of local variables must be automatically computed.IfthisflagIf this flag is true, then the arguments ofthethe visitMaxs method ofthetheCodeVisitorMethodVisitor returned bythethe visitMethodmethodmethod will be ignored, andwillbeignored,andcomputed automatically from the signatureandand the bytecode of eachthebytecodeofeachmethod.
Constructs a new ClassWriter object.Class ClassWriter, int newClass(String)@param computeMaxs true if the maximum stack size andthethemaximummaximum number of local variables must be automatically computed.IfthisflagIf this flag is true, then the arguments ofthethe visitMaxs method ofthetheCodeVisitorMethodVisitor returned bythethe visitMethodmethodmethod will be ignored, andwillbeignored,andcomputed automatically from the signatureandand the bytecode ofeach method.each@paramskipUnknownAttributestruetosilentlyignoreunknownmethod.attributes, or@paramfalseskipUnknownAttributestoDeprecated.throw an exception ifThe value of thisanunknownattributeparameter isfoundignored.
Adds a class reference to the constant pool of the class being build.Class ClassWriter, int newConst(Object)DoesDoes nothing if the constant pool already contains a similar item.ThisThis method is intended for Attribute sub classes, andisis normallynotnot needed by class generators or adapters.@param value the internal name of the class. @return the index of a new or already existing class reference item.
Adds a number or string constant to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item. This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.Class ClassWriter, int newField(String, String, String)@param cst the value of the constant to be added to the constant pool.ThisThis parameter must be an Integer, a Float,aa Long, a Double or a String. @return the index of a new or already existing constant item withthethegivengiven value.
Adds a field reference to the constant pool of the class being build.Class ClassWriter, int newMethod(String, String, String, boolean)DoesDoes nothing if the constant pool already contains a similar item.ThisThis method is intended for Attribute sub classes, andisis normallynotnot needed by class generators or adapters.@param owner the internal name of the field's owner class. @param name the field's name. @param desc the field's descriptor. @return the index of a new or already existing field reference item.
Adds a method reference to the constant pool of the class being build.Class ClassWriter, int newNameType(String, String)DoesDoes nothing if the constant pool already contains a similar item.ThisThis method is intended for Attribute sub classes, andisis normallynotnot needed by class generators or adapters.@param owner the internal name of the method's owner class. @param name the method's name. @param desc the method's descriptor. @param itf true if owner is an interface. @return the index of a new or already existing method reference item.
Adds a name and type to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item. This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.Class ClassWriter, int newUTF8(String)@param name a name. @param desc a type descriptor. @return the index of a new or already existing name and type item.
Adds an UTF8 string to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item. This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.Class ClassWriter, byte[] toByteArray()@param value the String value. @return the index of a new or already existing UTF8 item.
Returns the bytecode of the class that was build with this class writer.@return the bytecode of the class that was build with this class writer.
Returns the offset corresponding to this label. This offset is computed from the start of the method's bytecode. This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.Class Label, String toString()@return the offset corresponding to this label. @throws IllegalStateException if this label is not resolved yet.
Returns a string representation of this label.@return a string representation of this label.
A Java type. This class can be used to make it easier to manipulateClass Type, boolean equals(Object)type andtype and method descriptors. @author EricBruneton,Bruneton @author Chris Nokleberg
Tests if the given object is equal to this type.Class Type, Type[] getArgumentTypes(Method)@param o the object to be compared to this type. @return true if the given object is equal to this type.
Returns the Java types corresponding to the argument types of the given method.Class Type, Type[] getArgumentTypes(String)@param method a method. @return the Java types corresponding to the argument types of the given method.
Returns the Java types corresponding to the argument types of the given method descriptor.Class Type, String getClassName()@param methodDescriptor a method descriptor. @return the Java types corresponding to the argument types of the given method descriptor.
Returns the name of the class corresponding to this type.Class Type, String getDescriptor()@return the fully qualified name of the class corresponding to this type.
Returns the descriptor corresponding to this Java type.Class Type, String getDescriptor(Class)@return the descriptor corresponding to this Java type.
Returns the descriptor corresponding to the given Java type.Class Type, int getDimensions()@param c an object class, a primitive class or an array class. @return the descriptor corresponding to the given class.
Returns the number of dimensions of this array type.Class Type, Type getElementType()This methodshouldshould only be used for an array type.@return the number of dimensions of this array type.
Returns the type of the elements of this array type.Class Type, String getInternalName()This methodshouldshould only be used for an array type.@return Returns the type of the elements of this array type.
Returns the internal name of the class corresponding to this object type. The internal name of a class is its fully qualified name, where '.' are replaced by '/'. This method should only be used for an object type.Class Type, String getInternalName(Class)@return the internal name of the class corresponding to this object type.
Returns the internal name of the given class. The internal name ofClass Type, String getMethodDescriptor(Method)a classa class is its fully qualified name, where '.' are replaced by '/'.@param c an object class. @return the internal name of the given class.
Returns the descriptor corresponding to the given method.Class Type, String getMethodDescriptor(Type, Type[])@param m a Method object. @return the descriptor of the given method.
Returns the descriptor corresponding to the given argument and return types.Class Type, int getOpcode(int)@param returnType the return type of the method. @param argumentTypes the argument types of the method. @return the descriptor corresponding to the given argument and return types.
Returns a JVM instruction opcode adapted to this Java type.Class Type, Type getReturnType(Method)@param opcode a JVM instruction opcode. This opcode must be one of ILOAD, ISTORE, IALOAD, IASTORE, IADD, ISUB, IMUL, IDIV, IREM, INEG, ISHL, ISHR, IUSHR, IAND, IOR, IXOR and IRETURN. @return an opcode that is similar to the given opcode, but adaptedtotothisthis Java type. For example, if this type is float and opcode is IRETURN, this method returns FRETURN.
Returns the Java type corresponding to the return type of the given method.Class Type, Type getReturnType(String)@param method a method. @return the Java type corresponding to the return type of the given method.
Returns the Java type corresponding to the return type of the given method descriptor.Class Type, int getSize()@param methodDescriptor a method descriptor. @return the Java type corresponding to the return type of the given method descriptor.
Returns the size of values of this type.Class Type, int getSort()@return the size of values of this type, i.e., 2 for long and double, and 1 otherwise.
Returns the sort of this Java type.Class Type, Type getType(Class)@return VOID, BOOLEAN, CHAR,BYTE, SHORT, INT, FLOAT, LONG, DOUBLE, ARRAYoror OBJECT.
Returns the Java type corresponding to the given class.Class Type, Type getType(String)@param c a class. @return the Java type corresponding to the given class.
Returns the Java type corresponding to the given type descriptor.Class Type, int hashCode()@param typeDescriptor a type descriptor. @return the Java type corresponding to the given type descriptor.
Returns a hash code value for this type.Class Type, String toString()@return a hash code value for this type.
Returns a string representation of this type.@return the descriptor of this type.