David Portabella
David Portabella

Reputation: 12710

Is there a class annotation in FindBugs to ignore all warning in a file

there is an annotation in FindBugs to ignore a set of errors, for instance:

import edu.umd.cs.findbugs.annotations.SuppressWarnings;
@SuppressWarnings(value="DLS_DEAD_LOCAL_STORE", justification="...")

is there a way to ignore all types of errors for a java file, using an annotation?

I am awared that a file can be excluded from the command line or a configuration file: http://findbugs.sourceforge.net/manual/filter.html

but for this particular case, I would need to define this exclusion modifying only that java file.

Upvotes: 12

Views: 10233

Answers (1)

David Harkness
David Harkness

Reputation: 36532

Use the standard annotation with an empty string for the value attribute.

@SuppressWarnings(value = "")

If you use @SuppressFBWarnings instead of @SuppressWarnings to avoid the confusion with java.lang.SuppressWarnings and allow automatic importation in IDEs to work, you can even omit the value attribute entirely.

@SuppressFBWarnings

Upvotes: 19

Related Questions