Class LineNumbers


  • final class LineNumbers
    extends java.lang.Object
    Looks up line numbers for classes and their members.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int ASM_API_LEVEL  
      private int firstLine  
      private java.util.Map<java.lang.String,​java.lang.Integer> lines  
      private java.lang.String source  
      private java.lang.Class<?> type  
    • Constructor Summary

      Constructors 
      Constructor Description
      LineNumbers​(java.lang.Class<?> type)
      Reads line number information from the given class, if available.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getFirstLine()
      Gets the first line number.
      java.lang.Integer getLineNumber​(java.lang.reflect.Member member)
      Get the line number associated with the given member.
      java.lang.String getSource()
      Get the source file name as read from the bytecode.
      private java.lang.String memberKey​(java.lang.reflect.Member member)  
      • Methods inherited from class java.lang.Object

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

      • type

        private final java.lang.Class<?> type
      • lines

        private final java.util.Map<java.lang.String,​java.lang.Integer> lines
      • source

        private java.lang.String source
      • firstLine

        private int firstLine
    • Constructor Detail

      • LineNumbers

        public LineNumbers​(java.lang.Class<?> type)
                    throws java.io.IOException
        Reads line number information from the given class, if available.
        Parameters:
        type - the class to read line number information from
        Throws:
        java.io.IOException
    • Method Detail

      • getSource

        public java.lang.String getSource()
        Get the source file name as read from the bytecode.
        Returns:
        the source file name if available, or null
      • getLineNumber

        public java.lang.Integer getLineNumber​(java.lang.reflect.Member member)
        Get the line number associated with the given member.
        Parameters:
        member - a field, constructor, or method belonging to the class used during construction
        Returns:
        the wrapped line number, or null if not available
        Throws:
        java.lang.IllegalArgumentException - if the member does not belong to the class used during construction
      • getFirstLine

        public int getFirstLine()
        Gets the first line number.
      • memberKey

        private java.lang.String memberKey​(java.lang.reflect.Member member)