Class CodeData

All Implemented Interfaces:
Printable

public class CodeData extends MemberData<MethodData>
Code data for a code attribute in method members in a class of the Java Disassembler
  • Field Details

    • instructionAttrs

      private final HashMap<Integer,InstructionAttr> instructionAttrs
      (parsed) 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

      protected ArrayList<AttrData> attrs
    • trap_table

      private ArrayList<TrapData> trap_table
    • lin_num_tb

      private ArrayList<CodeData.LineNumData> lin_num_tb
      (parsed) Line Number table, describes source lines associated with ByteCode indexes
    • loc_var_tb

      private ArrayList<CodeData.LocVarData> loc_var_tb
      (parsed) Local Variable table, describes variable scopes associated with ByteCode indexes
    • stack_map

      private ArrayList<StackMapData> stack_map
      (parsed) stack map table, describes compiler hints for stack rep, associated with ByteCode indexes
    • visibleTypeAnnotations

      private ArrayList<TypeAnnotationData<MethodData>> visibleTypeAnnotations
      The visible type annotations for this method
    • invisibleTypeAnnotations

      private ArrayList<TypeAnnotationData<MethodData>> invisibleTypeAnnotations
      The invisible type annotations for this method
  • Constructor Details

  • Method Details

    • align

      private static int align(int n)
    • getByte

      private int getByte(int pc)
    • getUByte

      private int getUByte(int pc)
    • getShort

      private int getShort(int pc)
    • getUShort

      private int getUShort(int pc)
    • getInt

      private int getInt(int pc)
    • getInstructionAttribute

      protected InstructionAttr getInstructionAttribute(int pc)
    • readLineNumTable

      private void readLineNumTable(DataInputStream in) throws IOException
      Throws:
      IOException
    • readLocVarTable

      private void readLocVarTable(DataInputStream in) throws IOException
      Throws:
      IOException
    • readTrapTable

      private void readTrapTable(DataInputStream in) throws IOException
      Throws:
      IOException
    • readStackMapEntity

      private void readStackMapEntity(StackMapData.EAttributeType type, DataInputStream in) throws IOException
      Throws:
      IOException
    • readTypeAnnotations

      private void readTypeAnnotations(DataInputStream in, boolean isInvisible) throws IOException
      Throws:
      IOException
    • read

      public void read(DataInputStream in, int codeAttrLength) throws IOException
      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()
    • loadLocVarTable

      private void loadLocVarTable()
    • loadTrapTable

      private void loadTrapTable()
    • printInstrLn

      private int printInstrLn(int pc, int shift)
    • getLookupswitchPairs

      private Pair<Integer,Integer>[] getLookupswitchPairs(int pad, int count)
    • formatOperandLine

      private String formatOperandLine(String str, int offset, String prefix, List<Integer> breakPositions)
      Formats invokedynamic/ldc dynamic operand line
      Parameters:
      str - non-formatted operand line
      offset - indent for new lines
      prefix - prefix placed upfront new lines
      breakPositions - numbers where after ":" a lineSeparator is added to wrap a very long operand lines
      Returns:
      formatted operand line
    • print

      public void print() throws IOException
      Prints the code data to the current output stream. called from MethodData.
      Specified by:
      print in interface Printable
      Overrides:
      print in class Indenter
      Throws:
      IOException
    • getEnvironment

      public JdisEnvironment getEnvironment()