Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FindBugs filters: regex doesn't work in Class element

Tags:

java

findbugs

I'm trying to configure FindBugs to ignore missing equals methods for data object classes (name ends with DO suffix). The documentation says that this should work:

  <Match>
    <Class name=".*DO" />
    <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS" />
  </Match>

However it doesn't and I'm starting to doubt that regex is supported for Class/@name. Interesting thing is that this actually works:

  <Match classregex=".*DO">
    <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS" />
  </Match>

P.S.: I'm using FindBugs 2.0.1

like image 997
Andrei LED Avatar asked Sep 10 '25 14:09

Andrei LED


1 Answers

You need to add a tilde before regexs in FindBugs. So it should look more like this:

 <Match>
    <Class name="~.*DO" />
    <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS" />
 </Match>
like image 131
Jason Thompson Avatar answered Sep 13 '25 02:09

Jason Thompson