PMD is good tool, but sometime it stops you doing something for some special reason. In that case we need set the annotation to make PMD ignore that error.
For example
If you got the PMD error “The overriding method merely calls the same method defined in a superclass” and in some special scenario you have to do that. To avoid PMD checking on that, you can put the annotation below above the method
@SuppressWarnings("PMD.UselessOverridingMethod")For multiple ones,
@SuppressWarnings({"PMD.ExcessiveImports", "PMD.TooManyMethods"})
Each time when you ran PMD, it only gave you the full description "he overriding method merely calls ....", it did not give you the key (UselessOverridingMethod) which would be used in the annotation.
To find the key, go to http://pmd.sourceforge.net/rules/index.html and search the description you got and you can find the key there.
No comments:
Post a Comment