FindBugs
 
Docs and Info
 FindBugs 2.0
 Demo and data
 Users and supporters
 FindBugs blog
 Fact sheet
 Manual
 Manual(ja/日本語)
 FAQ
 Bug descriptions
 Bug descriptions(ja/日本語)
 Bug descriptions(fr)
 Mailing lists
 Documents and Publications
 Links
 
Downloads
 
FindBugs Swag
 
Development
 Open bugs
 Reporting bugs
 Contributing
 Dev team
 API [no frames]
 Change log
 SF project page
 Browse source
 Latest code changes

FindBugs sourceInfo file

The FindBugs analysis engine can be invoked with an optional sourceInfo file. This file gives line number ranges for classes, files and methods. This information is an alternative to getting line number information from the classfiles for methods. Since classfiles only contain line number information for methods, without a sourceInfo file we can't provide line numbers for fields, and for classes we just use the line numbers of the methods in the class.

The first line of the file should be

sourceInfo version 1.0

Following that are a series of lines, each describing a class, field, or method. For each, a starting and ending line number is provided. For example, the following sourceInfo file:

sourceInfo version 1.0
a.C,3,8
a.C,x,4,4
a.C,y,4,4
a.C,()V,8,8
a.C,f(I)I,5,5
a.C,g(Ljava/lang/Object;)I,6,7
provides the following information about the class a.C:
  • fields x and y are both declared on line 4.
  • the method int f(int) is defined on line 5.
  • the method int g(Object) is defined on lines 6-7.
  • the void constructor for a.C is defined on line 8.
The classnames should be the same format as used by Class.getName(): packages are separated by ., inner class names are separated by $. Thus, if the class a.C had an inner class X and it was onb lines 10-15 of the file, the sourceInfo file might contain:
a.C$X,10,15

Send comments to findbugs@cs.umd.edu

FindBugs on SourceForge.net