This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 229167

Summary: Editor reports Findbugs error on wrong line
Product: java Reporter: gualtiero65
Component: FindBugsAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P2    
Version: 7.3   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: IDE log
Screen shot editor
Test case (maven project)

Description gualtiero65 2013-04-29 14:45:41 UTC
Product Version = NetBeans IDE 7.3 (Build 201302132200)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_17
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.7-b01

The Findbugs editor integration show an error at line 17 while it is at line 16 (on a different method call).

Both Findbugs inspection (inside Netbeans) and maven Findbugs command-line check say the error is on line 16.
Comment 1 gualtiero65 2013-04-29 14:45:53 UTC
Created attachment 133937 [details]
IDE log
Comment 2 gualtiero65 2013-04-29 14:52:11 UTC
Created attachment 133938 [details]
Screen shot editor

Please note two arrows: first on editor line 17 (method metAnnotated) and second one on inspect window which show error on line 16 (method metSimple).
Comment 3 gualtiero65 2013-04-29 14:52:58 UTC
Created attachment 133940 [details]
Test case (maven project)
Comment 4 Quality Engineering 2013-05-09 02:36:31 UTC
Integrated into 'main-golden', will be available in build *201305082300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/9defc44722d6
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #229167: including a warning about difference in FindBugs results between editor and Source/Inspect.
Comment 5 Jan Lahoda 2013-05-09 06:35:13 UTC
In fact, the problem is not in showing the warning on a wrong line, the problem
is that there are two distinct warnings: in the Source/Inspect way, deeper
analysis is performed, which detects that Args1.metSimple cannot complete
normally for null parameter, and produces warning for that (and only for that).
Inside edito, the analysis is more shallow, and so the problem in
Args1.metSimple is not found, which leads to the warning on the other line.

I am afraid I don't see a way to fix that: the analysis inside editor is
passing only the classfile for the one file in the editor into FindBugs, for
performance reasons. Passing all the project's classfiles would be
prohibitively slow for anything but toy projects. I am not aware about any way
to run FindBugs incrementally (if you know about one, please let me know,
thanks). So the thing I think I can do is to add a warning that the results in
editor may differ from the ones in Source/Inspect, which I did by the above
changeset.
Comment 6 gualtiero65 2013-05-09 07:43:08 UTC
(In reply to comment #5)
So, if I understood well,
- in the editor, Findbugs analysis is on single class file with effort = min.
- in the inspection analysis, Findbugs scope is on complete project with effort = default or max.

I think this situation is a good solution and the warning let user understand there is a difference.

Thanks.

By the way, inspection analysis works at project level only. If I select the package and run inspection analysis on "current package", no errors/warnings are shown which it is not correct as all project source files are in that package.