IAmYourFaja
IAmYourFaja

Reputation: 56934

How to quiet FindBugs across multiple runs

I am running FindBugs on my project and am seeing a few instances where FindBugs is complaining about a potential bug, but I'm comfortable with the way it is coded up and am confident that it will not produce an actual bug.

I'm pouring through the FindBugs documentation and cannot find a way to "quiet"/suppress these "false positives" so that when I run FindBugs in the future it doesn't not complain about the specific ones I want to suppress.

Is this possible? Or is it a FindBugs anti-philosophy? Thanks in advance!

Upvotes: 0

Views: 190

Answers (2)

JB Nizet
JB Nizet

Reputation: 691913

Annotate the method, class or declaration with the findbugs SuppressWarnings annotations. For example:

@edu.umd.cs.findbugs.annotations.SuppressWarnings(
            value = "NP",
            justification = "if null, it'll throw a NPE as documented")

More information about FindBugs annotations here.

Upvotes: 1

samlewis
samlewis

Reputation: 4048

You can suppress warnings with annotations: http://findbugs.sourceforge.net/manual/annotations.html

Or by using a filter: http://findbugs.sourceforge.net/manual/filter.html#d0e1812

Upvotes: 0

Related Questions