Garfield Garfield - 8 months ago 90
Java Question

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:



(based on SuppressWarnings not working on FindBugs)

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

based on

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


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

Check Section 6 under .

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

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

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

Hope this helps someone!