Class LineNumberAttribute


  • public class LineNumberAttribute
    extends AttributeInfo
    LineNumberTable_attribute.
    • Field Detail

      • tag

        public static final java.lang.String tag
        The name of this attribute "LineNumberTable".
        See Also:
        Constant Field Values
    • Constructor Detail

      • LineNumberAttribute

        LineNumberAttribute​(ConstPool cp,
                            int n,
                            java.io.DataInputStream in)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • LineNumberAttribute

        private LineNumberAttribute​(ConstPool cp,
                                    byte[] i)
    • Method Detail

      • tableLength

        public int tableLength()
        Returns line_number_table_length. This represents the number of entries in the table.
      • startPc

        public int startPc​(int i)
        Returns line_number_table[i].start_pc. This represents the index into the code array at which the code for a new line in the original source file begins.
        Parameters:
        i - the i-th entry.
      • lineNumber

        public int lineNumber​(int i)
        Returns line_number_table[i].line_number. This represents the corresponding line number in the original source file.
        Parameters:
        i - the i-th entry.
      • toLineNumber

        public int toLineNumber​(int pc)
        Returns the line number corresponding to the specified bytecode.
        Parameters:
        pc - the index into the code array.
      • toStartPc

        public int toStartPc​(int line)
        Returns the index into the code array at which the code for the specified line begins.
        Parameters:
        line - the line number.
        Returns:
        -1 if the specified line is not found.
      • toNearPc

        public LineNumberAttribute.Pc toNearPc​(int line)
        Returns the index into the code array at which the code for the specified line (or the nearest line after the specified one) begins.
        Parameters:
        line - the line number.
        Returns:
        a pair of the index and the line number of the bytecode at that index.
      • copy

        public AttributeInfo copy​(ConstPool newCp,
                                  java.util.Map<java.lang.String,​java.lang.String> classnames)
        Makes a copy.
        Overrides:
        copy in class AttributeInfo
        Parameters:
        newCp - the constant pool table used by the new copy.
        classnames - should be null.
      • shiftPc

        void shiftPc​(int where,
                     int gapLength,
                     boolean exclusive)
        Adjusts start_pc if bytecode is inserted in a method body.