Package edu.umd.cs.findbugs.ba
Class SourceInfoMap
java.lang.Object
edu.umd.cs.findbugs.ba.SourceInfoMap
Global information about the source code for an application. Currently, this
object contains a map of source line information for fields and classes
(items we don't get line number information for directly in classfiles), and
also source line information for methods that don't appear directly in
classfiles, such as abstract and native methods.
- Author:
- David Hovemeyer
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A range of source lines. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addClassLine
(String className, SourceInfoMap.SourceLineRange range) Add line number entry for a class.void
addFieldLine
(String className, String fieldName, SourceInfoMap.SourceLineRange range) Add a line number entry for a field.void
addMethodLine
(String className, String methodName, String methodSignature, SourceInfoMap.SourceLineRange range) Add a line number entry for a method.boolean
getClassLine
(String className) Look up the line number range for a class.getFieldLine
(String className, String fieldName) Look up the line number range for a field.getMethodLine
(String className, String methodName, String methodSignature) Look up the line number range for a method.boolean
isEmpty()
void
read
(InputStream inputStream) Read source info from given InputStream.
-
Constructor Details
-
SourceInfoMap
public SourceInfoMap()Constructor. Creates an empty object.
-
-
Method Details
-
fallBackToClassfile
public boolean fallBackToClassfile() -
isEmpty
public boolean isEmpty() -
addFieldLine
Add a line number entry for a field.- Parameters:
className
- name of class containing the fieldfieldName
- name of fieldrange
- the line number(s) of the field
-
addMethodLine
public void addMethodLine(String className, String methodName, String methodSignature, SourceInfoMap.SourceLineRange range) Add a line number entry for a method.- Parameters:
className
- name of class containing the methodmethodName
- name of methodmethodSignature
- signature of methodrange
- the line number of the method
-
addClassLine
Add line number entry for a class.- Parameters:
className
- name of classrange
- the line numbers of the class
-
getFieldLine
Look up the line number range for a field.- Parameters:
className
- name of class containing the fieldfieldName
- name of field- Returns:
- the line number range, or null if no line number is known for the field
-
getMethodLine
@CheckForNull public SourceInfoMap.SourceLineRange getMethodLine(String className, String methodName, String methodSignature) Look up the line number range for a method.- Parameters:
className
- name of class containing the methodmethodName
- name of methodmethodSignature
- signature of method- Returns:
- the line number range, or null if no line number is known for the method
-
getClassLine
Look up the line number range for a class.- Parameters:
className
- name of the class- Returns:
- the line number range, or null if no line number is known for the class
-
read
Read source info from given InputStream. The stream is guaranteed to be closed.- Parameters:
inputStream
- the InputStream- Throws:
IOException
- if an I/O error occurs, or if the format is invalid
-