Class UnnecessaryPmdSuppressionRule

All Implemented Interfaces:
Rule, PropertySource

@Experimental public class UnnecessaryPmdSuppressionRule extends AbstractRule
A rule that reports unused suppression annotations and comments. This rule class supports any PMD language, but language-specific behavior needs to be implemented to avoid false positives for some languages. Violations of this rule cannot be suppressed. It is special cased by RuleSets to execute after all other rules, so that whether those produce warnings or not is known to this rule.
Experimental Status:
Since 7.14.0. See [core] Add rule to report unnecessary suppression comments/annotations #5609
  • Constructor Details

    • UnnecessaryPmdSuppressionRule

      public UnnecessaryPmdSuppressionRule()
  • Method Details

    • apply

      public void apply(Node rootNode, RuleContext ctx)
      Description copied from interface: Rule
      Process the given node. The nodes that are fed to this method are the nodes selected by Rule.getTargetSelector().
      Parameters:
      rootNode - Node on which to apply the rule
      ctx - Rule context, handling violations