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 158012 - Use FindBugs in hints
Summary: Use FindBugs in hints
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 8 votes (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-05 15:23 UTC by fommil
Modified: 2012-09-22 23:43 UTC (History)
4 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Screenshot of the problem (47.53 KB, image/png)
2010-01-11 12:50 UTC, mjr_1974
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fommil 2009-02-05 15:23:14 UTC
Please don't throw this out just because it refers to 3rd party software... FindBugs is open source and an incredible resource for finding bugs and stylistic 
problems in any Java software. Surely FindBugs could be seemlessly integrated into the Java hints system? FindBugs already has detectors and explanations... 
there is no need for automatic fixes to be provided.

The SQE plugin attempts to provide FindBugs functionality to NetBeans, but it is really really horrible and a disaster in UI design. The goal of this RFE would be 
to give the power of FindBugs detectors to Netbeans, without the end user even needing to know that findbugs was doing the work.
Comment 1 sreimers 2009-02-10 19:00:53 UTC
Could you perhaps be more precise about the UI? Any ideas what can / should be improved? Do not hesitate to use the SQE
mailinglist or issuetracker to request enhancements.
Comment 2 fommil 2009-02-10 22:07:29 UTC
@sreimers the UI problem with SQE is that there *is* a UI! There is absolutely no need for a UI. FindBugs finds problems, and they should be shown using 
the Netbeans Hints framework (yellow/red underlined with mouse-over actions available).

FindBugs could be run every time the file is saved and the FindBugs explanations used for the popups. There is no configuration necessary, except perhaps 
to "ignore this bug" or "ignore all bugs like this" (available during mouse-over, undo-able), which would then store the preferences in a config file in the 
nbproject folder.

SQE-specific (and not related to this FindBugs RFE) I would say the recommendations made by PMD and CheckStyle are simply atrocious. No need to use 
them at all. Secondly, the SQE plugin should be *ONE* plugin, not THREE! Additionally, if you really must have a control panel UI, then put it in the 
NetBeans preferences, not in its own window. And lastly... if you have buttons (e.g. checklists to select the backends, or refresh buttons), they really ought 
to do what they claim to do... last SQE I used, both those buttons were ignored. I found SQE to be so painful to use that I ended up using command-line 
FindBugs.

Comment 3 mjr_1974 2009-07-09 04:53:28 UTC
I also believe that FindBugs should be integrated into NetBeans as fommil suggested. I use FindBugs since NB 5, but
can't use it in NB 6.7. Fommil's ideas are very interesting. It's pretty an enhancement of how CheckStyle Beans is
integrated into NetBeans. I think that "just" having FindBugs integrated into NB without the possibility of
enabling/disabling detectors for a specific line will be a huge step forward for all the developers using NB.
Comment 4 sreimers 2009-07-09 05:30:15 UTC
I already have a working prototype using hints (and quick fixes) and hope to release the Real Soon Now (TM).
Comment 5 fommil 2009-07-09 10:04:50 UTC
@sreimers wow, excellent! I can't wait to see it... but please, you should have commented here that you were beginning work. We almost had a major task-
duplication problem ;-P

Could you please elaborate on what the support will look like?
Comment 6 sreimers 2009-07-09 19:08:47 UTC
The actual implementation is rescan on compile on a per file basis. All old-style workflow parts are still available as
well. The old annotation logic is still in there but will be removed, so only hints / quick fixes remain. 

There are plans for adding a possibility to add quickfixes using the layer file system, but work on this has not
started. Only quick fix available right now, is disabling detector (this needs fine-tuning as well).

I really hope to get this out of the door real soon now, but my day work keeps interfering.
Comment 7 sreimers 2010-01-11 06:38:07 UTC
This feature is currently available via http://sqe.kenai.com or the continous build update center at http://deadlock.netbeans.org/hudson/job/sqe/lastStableBuild/artifact/build/full-sqe-updatecenter/updates.xml
Comment 8 fommil 2010-01-11 07:21:30 UTC
@sreimers the whole point of this feature request is to have a much cleaner integration of FindBugs and the Java Hints module. The SQE plugin does not achieve this, and in fact has a much larger mandate.
Comment 9 sreimers 2010-01-11 10:28:35 UTC
@fommil Still not sure I get your point. Did you try the latest version of SQE? It adds hints for everything FindBugs detects - what else do you expect? There is even a first "Quick Fix" to add a suppress warnings annotation so that FindBugs will ignore those in future runs.

There is overhead in this solution, but I think the main part is configuring FindBugs for your project, so you will not get warnings you were never interested in.

What did I miss?
Comment 10 mjr_1974 2010-01-11 12:46:17 UTC
I just installed the new plug in and it looks very interesting. I feel most people in the community will be very pleased with this new addition!

I noticed that the Quality Control Center has hard coded colors and it does not blend as well as the other components of NB if you have a theme set (in my case the whole OS has a dark theme because we work in a dark environment).

I am attaching a picture of it so you can see what I am talking about.
Comment 11 mjr_1974 2010-01-11 12:50:43 UTC
Created attachment 93194 [details]
Screenshot of the problem
Comment 12 fommil 2010-01-11 14:14:10 UTC
@sreimers I've tried the latest SQE plugin - it is a *LOT* better than the previous version, but I do not believe it satisfies this RFE. This RFE is for seemless integration of FindBugs into the hints, whereas the plugin:-

* requires manual scanning
* provides a useless folder in the Project view
* uses up screen space in the Menu with a Quality entry

If the plugin satisfied the RFE, it would provide all configuration under Hints -> Java -> FindBugs and hints would be provided as mouse-overs on the hint warning - and there would be no "bug" icon.

Also, if I double click on a bug in the FindBugs window it will highlight it in the editor window - even if the bug has already been fixed.
Comment 13 fommil 2010-01-16 10:49:06 UTC
Hmm, ok - so the latest SQE plugin does a refresh every so often. Nice. Scrap that complaint then - but it still needs work.
Comment 14 mjr_1974 2010-02-01 13:01:38 UTC
Do you think that an on-demand scan in the popup menu in the project tree could be a possible solution to the high refresh rate of the plugin? 
The plugin is causing most of my time-limited tests to fail (like gui and performance tests) because it starts scanning when running the tests.
Comment 15 fommil 2010-02-01 14:30:04 UTC
I quite like the auto-scan, but I admit, it could do with being less frequent! An automatic scan when opening up NetBeans, or the project, would be sufficient for my purposes. Perhaps even once an hour, or something of that order of magnitude. If there were no performance penalty, scan on save would be optimal, of course.
Comment 16 markiewb 2012-09-22 23:43:16 UTC
Findbugs was natively integrated into NB7.2. This also includes hint-support. So closing this issue. 

For more details see http://netbeans.org/kb/docs/java/code-inspect.html#fb