Skip to content

[java] UnusedModifier doesn't check static keyword on nested enum declaration #248

Closed
@jsotuyod

Description

@jsotuyod

Rule Set: unused/UnusedModifier

Description:
Enums are static by default. 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.

Code Sample demonstrating the issue:

public @interface Test {
  public static enum EnumSample {
    TEST;
  }
}

PMD will find no violations on this annotation, 1 violation is expected.

The behavior is consistent when nested in classes, annotations and interfaces.

Running PMD through: Any

Metadata

Metadata

Assignees

Labels

a:bugPMD crashes or fails to analyse a file.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions