Class ClassReader
java.lang.Object
mockit.asm.util.BytecodeReader
mockit.asm.AnnotatedReader
mockit.asm.classes.ClassReader
A Java class parser to make a
ClassVisitor visit an existing class.
The Java type to be parsed is given in the form of a byte array conforming to the Java class file format. For each field and method encountered, the appropriate visit method of a given class visitor is called.
-
Field Summary
Fields inherited from class AnnotatedReader
access, signatureFields inherited from class BytecodeReader
code, codeIndex, items -
Constructor Summary
ConstructorsConstructorDescriptionClassReader(byte[] code) Initializes a new class reader with the given bytecode array for a classfile. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ClassVisitor visitor) Makes the given visitor visit the Java class of this Class Reader.intReturns the class's access flags.@NonNegative intgetBSMCodeIndex(@NonNegative int bsmStartIndex) byte[]Returns the bytecode array of the Java classfile that was read.Returns the internal of name of the super class.intReturns the classfile version of the class being read.protected BooleanreadAttribute(String attributeName) Attempts to read the next attribute, provided it's one recognizable by the implementing subclass.Methods inherited from class AnnotatedReader
readAnnotations, readAnnotationValues, readAttributesMethods inherited from class BytecodeReader
readBoolean, readChar, readClass, readConst, readConstItem, readConstItem, readDouble, readDouble, readFloat, readFloat, readInt, readInt, readItem, readItem, readLong, readLong, readMethodHandle, readMethodHandleItem, readNonnullClass, readNonnullClass, readNonnullUTF8, readNonnullUTF8, readShort, readShort, readSignedByte, readString, readUnsignedByte, readUnsignedByte, readUnsignedShort, readUnsignedShort, readUTF8, readUTF8
-
Constructor Details
-
ClassReader
public ClassReader(@NonNull byte[] code) Initializes a new class reader with the given bytecode array for a classfile.
-
-
Method Details
-
getVersion
public int getVersion()Returns the classfile version of the class being read. -
getAccess
public int getAccess()Returns the class's access flags. -
getSuperName
-
getBytecode
@NonNull public byte[] getBytecode()Returns the bytecode array of the Java classfile that was read. -
accept
Makes the given visitor visit the Java class of this Class Reader. -
readAttribute
Description copied from class:AnnotatedReaderAttempts to read the next attribute, provided it's one recognizable by the implementing subclass.- Specified by:
readAttributein classAnnotatedReader- Parameters:
attributeName- the attribute name- Returns:
trueifBytecodeReader.codeIndexis already pointing to the next attribute in the classfile,falseornullotherwise; in the case ofnull, the current attribute was not yet identified, but is one of the more general ones ("RuntimeVisibleAnnotations", "Deprecated", or "Synthetic")
-
getBSMCodeIndex
public @NonNegative int getBSMCodeIndex(@NonNegative int bsmStartIndex)
-