How to suppress FindBugs warnings for fields or local variables?

@SuppressFBWarnings on a field only suppresses findbugs warnings reported for that field declaration, not every warning associated with that field.

For example, this suppresses the “Field only ever set to null” warning:

@SuppressFBWarnings("UWF_NULL_FIELD")
String s = null;

I think the best you can do is isolate the code with the warning into the smallest method you can, then suppress the warning on the whole method.

Note: @SuppressWarnings was marked deprecated in favor of @SuppressFBWarnings

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)