Skip to content

PMD: remove redundant 'implements' (UnnecessaryInterfaceDeclaration)#7640

Open
Vest wants to merge 1 commit into
PCGen:masterfrom
Vest:pmd-unnecessary-interface
Open

PMD: remove redundant 'implements' (UnnecessaryInterfaceDeclaration)#7640
Vest wants to merge 1 commit into
PCGen:masterfrom
Vest:pmd-unnecessary-interface

Conversation

@Vest

@Vest Vest commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What

Removes redundant implements clauses across 29 files in code/src/java, flagged by PMD's UnnecessaryInterfaceDeclaration rule. Each removed interface is already provided by a supertype in the inheritance chain.

Why

PMD's pmdMain task reports these as violations. The declarations are pure noise — they don't change semantics (the marker / contract is still inherited) and they obscure which interfaces the class actually adds.

Scope

Cluster Sites
Originally flagged by PMD 32
Cascaded after fixing parent classes (CDOMObject, AbstractCategory no longer shadowed by subclass declarations) 3
Total 35

Removed markers include: Cloneable, Comparable<Object>, Serializable, VarScoped, VarContainer, Loadable, ObjectContainer<T>, Category<T>, ReferenceFacade<T>, DataView<T>, ReferenceListener<T>, TreeTableModel, CDOMToken<T>, PCGenScoped, ReferenceManufacturer<T> — all guaranteed by the supertype.

Verification

  • ./gradlew compileJava compileTestJava compileItestJava compileSlowtestJava — all green
  • ./gradlew pmdMainUnnecessaryInterfaceDeclaration count: 22 → 0; overall PMD count: 110 → 75

Notes

  • Cloneable is a marker interface, so the explicit declaration on a concrete class was a (mild) self-documenting hint. Removing it is correct per the rule and the supertype keeps the marker.
  • Scope-limited to one rule. Other PMD clusters (VariableDeclarationUsageDistance, PublicMemberInNonPublicType, OverridingThreadRun, AvoidUsingVolatile) are untouched.
  • code/gradle/reporting.gradle still has pmd { ignoreFailures = true }, so CI gating is unchanged; this PR just reduces the noise floor.

PMD's UnnecessaryInterfaceDeclaration rule flagged 22 sites where a
class/interface declared an 'implements' that a supertype already
provided. Removed those declarations, plus 3 more that surfaced after
the parent classes (CDOMObject, AbstractCategory) stopped being
shadowed by their subclasses.

Touches markers (Cloneable, Comparable, Serializable, VarScoped,
VarContainer, Loadable, ObjectContainer, Category, ReferenceFacade,
DataView, ReferenceListener, TreeTableModel, CDOMToken, etc.) — all
guaranteed by the supertype chain. Compile + all four test source
sets verified clean.

pmdMain count: 110 -> 75.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant