Search code examples
findbugsspotbugs

Ignore findbugs also ignores other


Getting these bugs:

OPM_OVERLY_PERMISSIVE_METHOD
IMC_IMMATURE_CLASS_NO_TOSTRING
PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS
RI_REDUNDANT_INTERFACES

after adding this to findbugs-exclude.xml

<Match>
  <Not>
    <Bug code="IMC_IMMATURE_CLASS_NO_TOSTRING"/>
  </Not>
</Match>

I no longer see any of the four listed bugs. I was only expecting IMC_IMMATURE_CLASS_NO_TOSTRING to be ignored


Solution

  • Remove the <Not> operator, like so:

    <Match>
      <Bug pattern="IMC_IMMATURE_CLASS_NO_TOSTRING"/>
    </Match>
    

    The exclusion filter specifies what not to check, so the extra Not made it exclude everything except IMC_IMMATURE_CLASS_NO_TOSTRING.