Skip to content

[java] New Rule: UnnecessaryInterfaceDeclaration#6458

Merged
adangel merged 1 commit intopmd:mainfrom
zbynek:extra-interface
Feb 23, 2026
Merged

[java] New Rule: UnnecessaryInterfaceDeclaration#6458
adangel merged 1 commit intopmd:mainfrom
zbynek:extra-interface

Conversation

@zbynek
Copy link
Contributor

@zbynek zbynek commented Feb 14, 2026

Describe the PR

Add a new rule that reports unnecessary "implements" and "extends" declarations.
Similar to https://www.jetbrains.com/help/inspectopedia/RedundantInterfaceDeclaration.html

The IntelliJ's rule has two settings, to allow Serializable and/or Cloneable. Here I implemented a single property that allows listing arbitrary interfaces, with Serializable being the default exemption (it seems to be declared quite often explicitly in JDK and Spring even if not needed).

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@pmd-actions-helper
Copy link
Contributor

pmd-actions-helper bot commented Feb 15, 2026

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 105 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.

Regression Tester Report

(comment created at 2026-02-15 10:15:35+00:00 for 5b00950)

@zbynek zbynek force-pushed the extra-interface branch 2 times, most recently from 8aa1f11 to 3f5b98d Compare February 15, 2026 09:49
@zbynek zbynek changed the title [java] new rule: UnnecessaryImplementsDeclaration [java] new rule: UnnecessaryInterfaceDeclaration Feb 15, 2026
@zbynek zbynek marked this pull request as ready for review February 15, 2026 11:20
@adangel adangel changed the title [java] new rule: UnnecessaryInterfaceDeclaration [java] New Rule: UnnecessaryInterfaceDeclaration Feb 22, 2026
@adangel adangel added the a:new-rule Proposal to add a new built-in rule label Feb 22, 2026
@adangel adangel added this to the 7.22.0 milestone Feb 22, 2026
Copy link
Member

@adangel adangel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

adangel added a commit that referenced this pull request Feb 23, 2026
@adangel adangel merged commit 2a3a1a1 into pmd:main Feb 23, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a:new-rule Proposal to add a new built-in rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants