Class LocalVariableTableWriter


  • public final class LocalVariableTableWriter
    extends ClassWriter.Element
    This class helps emit LocalVariableTable attributes.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int copyInto​(byte[] buf, int offset)
      Copy the bytes into 'buf' at offset 'offset'.
      int getSize()  
      static int[] makeRawTable​(int[][] varMap, Compiler.Output output)
      Build a raw local variable table from a formatted variable map.
      void setRawTable​(int[] table)
      Set the raw local variable table values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LocalVariableTableWriter

        public LocalVariableTableWriter​(ClassWriter w)
        Create a blank LocalVariableTable.
        Throws:
        java.lang.IllegalArgumentException - if w is null
    • Method Detail

      • setRawTable

        public void setRawTable​(int[] table)
        Set the raw local variable table values. Consider using LocalVariableTableWriter.makeRawTable to build the raw values.
        Parameters:
        table - the raw values, a flattened sequence of (startPC, length, nameIndex, typeIndex, var) tuples
      • getSize

        public int getSize()
        Specified by:
        getSize in class ClassWriter.Element
        Returns:
        the number of bytes that will be generated.
      • copyInto

        public int copyInto​(byte[] buf,
                            int offset)
                     throws java.lang.IllegalArgumentException
        Description copied from class: ClassWriter.Element
        Copy the bytes into 'buf' at offset 'offset'.
        Specified by:
        copyInto in class ClassWriter.Element
        Returns:
        the number of bytes copies, which must be equal to getSize()
        Throws:
        java.lang.IllegalArgumentException
      • makeRawTable

        public static int[] makeRawTable​(int[][] varMap,
                                         Compiler.Output output)
                                  throws java.lang.IllegalArgumentException
        Build a raw local variable table from a formatted variable map.
        Parameters:
        varMap - an array mapping bytecode offsets to a variable map for each offset; a variable map is a array of 2*localVars elements, containing a (nameIndex, typeIndex) for each local variable; the pair (0,0) indicates that there is no information about that local variable at that offset
        Throws:
        java.lang.IllegalArgumentException - if varMap == null