A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/246 below:

[java] UnusedModifier doesn't check annotations · Issue #246 · pmd/pmd · GitHub

Rule Set: unused/UnusedModifier

Description:
Annotation elements are public abstract by default, no other modifiers are allowed. Explicitly setting them matches this rule's criteria:

For historical reasons, modifiers which are implied by the context are accepted by the compiler, but are superfluous.

The same applies to fields on annotations, which are public static final by default.

Code Sample demonstrating the issue:

public @interface Test {
  public static final String DEFAULT_MESSAGE = "message";
  public abstract String message() default DEFAULT_MESSAGE;
}

PMD will find no violations on this annotation, 5 violations are expected.

Running PMD through: Any

P.S. This class should probably go to the unnecessary ruleset rather the unused one... even the unit tests' description usually start with "Unnecessary ..."


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4