FindBugs can ignore warnings using annotations. The problem with this approach is that it introduces an unnecessary dependency into the code. It would be nice if there was a //NOFINDBUGS comment to signal to FindBugs to ignore the error the way there is a //NOPMD trigger for PMD.
FindBugs is a bytecode scanning tool, so it has its own limitations. Comments never go into .class files, so FindBugs is unable to check them. There are many ways to ignore warnings in FindBugs: annotations, filter files, FindBugs cloud. I think there's no need for one more way.
Note that if you don't want to have extra dependency, you can define a SuppressFBWarnings annotation anywhere in your project. Just add this annotation class anywhere and use it:
FindBugs doesn't care in which package this annotation is defined.
I guess, this should be closed-wont-fix. Bill, Andrey, what do you think?
Last edit: Tagir Valeev 2014-11-11
I agree.
Scanning sources for comments would also decrease analysis performance. Also sometimes the warning is placed not where one would expect a comment.
Regards,
Andrey