Class StackMapData

All Implemented Interfaces:
Printable

public class StackMapData extends MemberData<CodeData>
Represents one entry of StackMapTable attribute:

union stack_map_entry { same_frame; same_locals_1_stack_item_frame; same_locals_1_stack_item_frame_extended; chop_frame; same_frame_extended; append_frame; full_frame; }

or StackMap attribute

stack_map_entry { u2 offset; u2 number_of_locals; verification_type_info locals[number_of_locals]; u2 number_of_stack_items; verification_type_info stack[number_of_stack_items]; }

See Also:
  • Field Details

    • range

      static Range<Integer> range
    • attribute

      private final EAttribute attribute
    • stackEntryType

      StackMap.EntryType stackEntryType
    • stackEntryTypeValue

      int stackEntryTypeValue
    • isWrapped

      boolean isWrapped
    • wrapLevel

      int wrapLevel
    • frame_pc

      int frame_pc
    • offset

      int offset
    • lockMap

      int[] lockMap
    • stackMap

      int[] stackMap
    • unsetFields

      int[] unsetFields
    • printer

      private StackMapData.Printer printer
    • doubleIndent

      private int doubleIndent
    • tripleIndent

      private int tripleIndent
    • intLine

      private String intLine
    • strLine

      private String strLine
    • shift

      private int shift
    • tableHeader

      private String tableHeader
  • Constructor Details

    • StackMapData

      public StackMapData(CodeData code, DataInputStream in) throws IOException
      Constructor for ATT_StackMap (Java 5,6)
      Parameters:
      code - the code attribute where this attribute is located
      in - the input stream
      Throws:
      IOException - the exception if something went wrong
    • StackMapData

      public StackMapData(boolean firstStackMap, int prevFrame_pc, CodeData code, DataInputStream in) throws IOException
      Constructor for ATT_StackMapTable (Java 6, 7+)
      Parameters:
      firstStackMap - is it an entries[0] in the stack_map_entry structure? i.e. Does the StackMapData describe the second stack map frame of the method?
      prevFrame_pc - the bytecode offset of the previous entry (entries[current_index-1])
      code - the code attribute where this attribute is located
      in - the input stream
      Throws:
      IOException - the exception if something went wrong
  • Method Details

    • jasmPrint

      protected void jasmPrint(int index, int size) throws IOException
      Prints the StackMap data in Jasm format.
      Overrides:
      jasmPrint in class Indenter
      Parameters:
      index - the index of the current entry
      size - the total number of entries
      Throws:
      IOException - if an I/O error occurs while printing
    • stackMapPrinter

      private void stackMapPrinter(int index, int size) throws IOException
      Throws:
      IOException
    • stackMapTablePrinter

      private void stackMapTablePrinter(int index, int size)
    • tablePrint

      protected void tablePrint(int index, int size) throws IOException
      Overrides:
      tablePrint in class Indenter
      Throws:
      IOException
    • isPrintable

      public boolean isPrintable()
    • getFramePC

      public int getFramePC()
      Returns:
      the bytecode offset at which a stack map frame applies
    • getStackEntryType

      public StackMap.EntryType getStackEntryType()
    • getFieldListAsString

      public Pair<List<String>, List<String>> getFieldListAsString(int[] fields)
    • getMapListAsString

      public Pair<String,String> getMapListAsString(int[] map, String delimiter)
    • belongsToStackMapTable

      public boolean belongsToStackMapTable()
      Returns:
      true if the entity presents a StackMapTable since Java 6
    • setPrintParticles

      public StackMapData setPrintParticles(String intLine, String strLine, int shift)
      Sets helper printing particles
    • setHeader

      public StackMapData setHeader(String header)
      Sets table header
    • readMap

      private int[] readMap(DataInputStream in) throws IOException
      Throws:
      IOException
    • readFields

      private int[] readFields(DataInputStream in) throws IOException
      Throws:
      IOException
    • readMapElements

      private int[] readMapElements(DataInputStream in, int num) throws IOException
      Throws:
      IOException
    • getCommentOffsetFor

      private int getCommentOffsetFor(String line, int shiftCount)
    • getCommentOffsetFor

      private int getCommentOffsetFor(int lineLength, int shiftCount)