Class CodeData
- All Implemented Interfaces:
Printable
Code data for a code attribute in method members in a class of the Java Disassembler
-
Nested Class Summary
Nested classes/interfaces inherited from class MemberData
MemberData.AnnotationElementStateNested classes/interfaces inherited from class Indenter
Indenter.NotImplementedException -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprotected byte[]private booleanprivate final HashMap<Integer, InstructionAttr> reversed bytecode index hash, associates labels with ByteCode indexesprivate intprivate ArrayList<TypeAnnotationData<MethodData>> private Container<LineNumberData, CodeData> private Container<LocalVariableData, CodeData> private Container<LocalVariableTypeData, CodeData> protected intprotected intprivate StackMapTableprivate ArrayList<TypeAnnotationData<MethodData>> Fields inherited from class MemberData
access, attributes, data, DEFAULT_VALUE_PREFIX, environment, invisibleAnnotations, isDeprecated, isSynthetic, memberType, owner, pool, signature, visibleAnnotationsFields inherited from class Indenter
ARGUMENT_DELIMITER, bestEffort, BootstrapArgumentsBreakPositions, BootstrapMethodBreakPositions, CIRCULAR_COMMENT_OFFSET, COMMENT_PADDING, commentOffset, detailedOutput, dropCharacterRange, dropClasses, dropSignatures, dropSourceFile, extraDetailedOutput, hasSize, INDENT_CHAR, INDENT_OFFSET, INDENT_STEP, INDENT_STRING, INITIAL_COMMENT_OFFSET, INSTR_PREFIX_LENGTH, InvokeDynamicBreakPositions, LdwBreakPositions, LINE_SPLITTER, maxSize, maxSizeCalculated, NO_BSM_ARGUMENTS, NO_BSM_ARGUMENTS_REGEX, OPERAND_PLACEHOLDER_LENGTH, printable, printConstantPool, printCPIndex, printHEX, printLabelAsIdentifiers, printLineNumber, printLineTable, printLineTableLines, printLineTableNumbers, printLocalVariables, printLocalVariableTypes, printProgramCounter, printSourceLines, PROGRAM_COUNTER_PLACEHOLDER_LENGTH, REPLACEMENT_NO_BSM_ARGUMENTS, skipComments, STACKMAP_TYPE_PLACEHOLDER_LENGTH, sysInfo, TABLE_PADDING, tableFormat, tableToken, toolOutput, UNDEFINED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static intalign(int n) private booleancalculateFirstPosition(int index) Calculates whether a StackMapTable[index] entry is the first in the table, ignoring wrapperscheckCodeBounds(int ind, int count) Checks whether the bytes corresponding to the instruction's parameters belong to the code attribute.private intcheckForLabelRef(int pc) private intgetByte(int pc) protected InstructionAttrprotected InstructionAttrgetInstructionAttribute(int pc) private intgetInt(int pc) protected InstructionAttrgetLookupswitchPairs(int pad, int count) private intgetShort(int pc) private intgetUByte(int pc) private intgetUShort(int pc) private voidprivate voidprivate voidprivate voidprivate voidprivate voidvoidprint()Prints the code data to the current output stream if code exists (method isn't abstract)protected <T extends AnnotationData>
voidprintAnnotations(List<T>... annotationLists) Prints ClassData annotationsprivate voidprintBytes(byte opcode, List<Byte> bytes, int shift) private intprintInstrLn(int pc, int shift) voidread(DataInputStream in, int codeAttrLength) Read and resolve the code attribute data called from MethodData.private Container<LineNumberData, CodeData> readLineNumberTable(DataInputStream in, boolean ignoreMemorization) private Container<LocalVariableData, CodeData> readLocalVariableTable(DataInputStream in, boolean ignoreMemorization) private Container<LocalVariableTypeData, CodeData> readLocalVariableTypeTable(DataInputStream in, boolean ignoreMemorization) private voidreadStackMapEntity(EAttribute attribute, DataInputStream in) private voidprivate voidreadTypeAnnotations(DataInputStream in, boolean isInvisible) setSignature(SignatureData signatureData) Methods inherited from class MemberData
calculateInlinedTitleShift, getAnnotationElementState, getAnnotationsCount, getConstantPool, getListOf, getPseudoFlagsAsString, handleAttributes, handleUnrecognizedAttributes, init, printAttributes, printSysInfo, printVar, readAttributes, setElementState, setOwnerMethods inherited from class Indenter
decIndent, decIndent, enlargedIndent, enlargedIndent, formatOperandLine, getCommentOffset, getIndentSize, getIndentStep, getIndentString, getLabelPrefix, getOffset, getPrintAttributeCommentPadding, getPrintAttributeKeyPadding, getTitle, incIndent, incIndent, Indent, IndentPadLeft, IndentPadRight, initIndent, isTableOutput, jasmPrint, jasmPrint, nCopies, padLeft, PadLeft, padRight, PadRight, print, print, print, printIndent, printIndent, printIndent, printIndentLn, printIndentLn, printIndentLn, printIndentPadLeft, printIndentPadRight, println, println, println, println, printPadLeft, printPadRight, setCommentOffset, setHasSize, setOffset, setTheSame, tableFormatSupported, tablePrint, tablePrintMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Printable
isPrintable
-
Field Details
-
instructionAttrs
reversed bytecode index hash, associates labels with ByteCode indexes -
code
protected byte[] code -
max_stack
protected int max_stack -
max_locals
protected int max_locals -
attrs
-
trap_table
-
lineNumberTable
-
localVariableTable
-
localVariableTypeTable
-
stackMapTable
-
firstStackEntry
private boolean firstStackEntry -
visibleTypeAnnotations
-
invisibleTypeAnnotations
-
instructionOffset
private int instructionOffset -
attributeOffset
private int attributeOffset
-
-
Constructor Details
-
CodeData
-
-
Method Details
-
align
private static int align(int n) -
getByte
- Throws:
IndexOutOfBoundsException
-
getUByte
- Throws:
IndexOutOfBoundsException
-
getShort
- Throws:
IndexOutOfBoundsException
-
getUShort
- Throws:
IndexOutOfBoundsException
-
getInt
- Throws:
IndexOutOfBoundsException
-
getInstructionAttribute
-
getLastInstruction
-
getFirstInstruction
-
readLineNumberTable
private Container<LineNumberData, CodeData> readLineNumberTable(DataInputStream in, boolean ignoreMemorization) throws IOException - Throws:
IOException
-
readLocalVariableTable
private Container<LocalVariableData, CodeData> readLocalVariableTable(DataInputStream in, boolean ignoreMemorization) throws IOException - Throws:
IOException
-
readLocalVariableTypeTable
private Container<LocalVariableTypeData, CodeData> readLocalVariableTypeTable(DataInputStream in, boolean ignoreMemorization) throws IOException - Throws:
IOException
-
readTrapTable
- Throws:
IOException
-
readStackMapEntity
- Throws:
IOException
-
calculateFirstPosition
private boolean calculateFirstPosition(int index) Calculates whether a StackMapTable[index] entry is the first in the table, ignoring wrappers- Parameters:
index- index of the entry in the StackMapTable- Returns:
- true if index refers to the first entry that isn't wrapper.
-
readTypeAnnotations
- Throws:
IOException
-
read
Read and resolve the code attribute data called from MethodData. precondition: NumFields has already been read from the stream.- Throws:
IOException
-
checkForLabelRef
private int checkForLabelRef(int pc) -
loadLabelTable
private void loadLabelTable() -
loadLineNumTable
private void loadLineNumTable() -
loadStackMap
private void loadStackMap() -
loadLocalVariableTable
private void loadLocalVariableTable() -
loadLocalVariableTypeTable
private void loadLocalVariableTypeTable() -
loadTrapTable
private void loadTrapTable() -
printInstrLn
private int printInstrLn(int pc, int shift) -
printBytes
-
checkCodeBounds
Checks whether the bytes corresponding to the instruction's parameters belong to the code attribute.- Parameters:
ind- code index of the instructioncount- number of bytes corresponding to the instruction's parameters- Returns:
- The list of bytes corresponds to the instruction's parameters that belong to the code attribute. If the count does not match the list size, it indicates that the instruction is truncated.
-
getLookupswitchPairs
-
print
Prints the code data to the current output stream if code exists (method isn't abstract)- Specified by:
printin interfacePrintable- Overrides:
printin classIndenter- Throws:
IOException
-
setSignature
- Overrides:
setSignaturein classMemberData<MethodData>
-
getEnvironment
-
printAnnotations
protected <T extends AnnotationData> void printAnnotations(List<T>... annotationLists) throws IOException Prints ClassData annotations- Overrides:
printAnnotationsin classMemberData<MethodData>- Throws:
IOException- signals that an exception of some sort has occurred
-