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

David Portabella picture David Portabella · Nov 15, 2012 · Viewed 9k times · Source

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.

Answer

David Harkness picture David Harkness · Nov 18, 2012

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