Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DLS_DEAD_LOCAL_STORE SuppressWarnings FindBugs false positive

I'm trying to eliminate a false positive for DLS_DEAD_LOCAL_STORE

Here's what I have tried so far:

@SuppressWarnings("DLS_DEAD_LOCAL_STORE")

@edu.umd.cs.findbugs.annotations.SuppressWarnings("DLS_DEAD_LOCAL_STORE")

(based on SuppressWarnings not working on FindBugs)

@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "DLS_DEAD_LOCAL_STORE", justification = "please go away")

based on http://osdir.com/ml/java-findbugs-general/2010-06/msg00017.html

But none of the options is helping. Please advice. Using Eclipse Indigo.

like image 294
Garfield Avatar asked Jul 22 '13 22:07

Garfield


1 Answers

More Googling + Experimenting and I finally figured out a way to do this.

Check Section 6 under http://findbugs.sourceforge.net/manual/filter.html .

You need to create your own XML file with all the custom supressions in there. You'll then need let build.xml file know about this file via findbugs.exclude.filter

 <Match>
   <Class name="com.foobar.MyClass" />
   <Method name="someMethod" />
   <Bug pattern="DLS_DEAD_LOCAL_STORE" />
 </Match>

No need to add the @SuppressWarnings tag in the method once this is there in the XML.

Hope this helps someone!

like image 52
Garfield Avatar answered Sep 18 '22 03:09

Garfield