How to make Checkstyle ignore the final method rule for classes marked with @Entity annotation?

Say I have classes marked with @Entity annotation

@Entity
class User {

   public String getName(String name) {
      return this.name;
   }

}

Checkstyle will report that the class is not created for extension and offers labeling of methods with the final (or the whole class). I cannot do this because it is marked as an object that cannot be final.

How do I get Checkstyle to ignore the classes marked with @Entity for this rule?

thank

+3
source share
3 answers

See SuppressionFilter or SuppressionCommentFilter

The SuppressionFilter filter rejects the audit event for error checking according to the suppresses the XML document in the file.

+1
+1

Are you using Ant build? If so, in your target checklist, try something like:

<checkstyle>
    <fileset dir="src.dir">
        <include name="**/*.java" />
        <exclude name="User.java" />
    </fileset>
</checkstyle>
0
source

All Articles