Class LocalVariableTableWriter


  • public final class LocalVariableTableWriter
    extends ClassWriter.Element
    This class helps emit LocalVariableTable attributes.
    • 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.
      • makeRawTable

        public static int[] makeRawTable​(int[][] varMap,
                                         Compiler.Output output)
                                  throws 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:
        IllegalArgumentException - if varMap == null