Skip to content

fix: satisfy PMD 7.26.0 across the reactor (visibility + assertEquals order)#1451

Open
joaodinissf wants to merge 1 commit into
dsldevkit:masterfrom
joaodinissf:fix/pmd-public-member-nonpublic-type
Open

fix: satisfy PMD 7.26.0 across the reactor (visibility + assertEquals order)#1451
joaodinissf wants to merge 1 commit into
dsldevkit:masterfrom
joaodinissf:fix/pmd-public-member-nonpublic-type

Conversation

@joaodinissf

@joaodinissf joaodinissf commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

PMD 7.26.0 tightens two rules that now flag pre-existing code across the reactor, breaking the maven-pmd-plugin check goal. This clears every violation with real fixes — no rule suppressions.

PublicMemberInNonPublicType

Drops the needless public on members declared in non-public (anonymous / nested) types, narrowing each to the minimum the override allows:

  • QualifiedNameSegmentTreeLookup — three visit(SegmentNode) overrides → package-private (they override a package-private Visitor.visit).
  • ScopingGeneratorUtil / ExportGeneratorSupport — the allPackages() overrides → protected (the framework's EmfRegistryMetaModel.allPackages() is itself protected; the migration had widened it).
  • AbstractFragmentProviderTest — the appendEscaped / unescape test hooks → protected (same-package test access preserved).

AssertEqualsArgumentOrder

Puts expected before actual in five assertEquals calls (BasicModelTest, AbstractValidationTest, AbstractQuickFixTest, AbstractFragmentProviderTest, QualifiedNameSegmentTreeLookupTest). Behaviour-preserving — only corrects the reported expected/actual order.

Why now

Unblocks the Dependabot bump #1449 (pmd.version 7.25.0 → 7.26.0). Landing this on master first lets #1449 rebase to a clean, green, bump-only PR.

Verification

Full reactor build with compilation (so PMD has real type resolution), under the new version:

mvn clean verify checkstyle:check pmd:pmd pmd:cpd pmd:check pmd:cpd-check spotbugs:check \
    -f ddk-parent/pom.xml -Dpmd.version=7.26.0 -DskipTests

BUILD SUCCESS, 0 PMD violations, 64 modules.

Note: a no-compile pmd:check under-reports type-resolution-dependent findings, so the compile step is required to reproduce CI's maven-verify job faithfully.

🤖 Generated with Claude Code

@joaodinissf joaodinissf marked this pull request as ready for review July 3, 2026 20:08
@joaodinissf joaodinissf requested a review from rubenporras July 3, 2026 20:08
@joaodinissf joaodinissf enabled auto-merge (rebase) July 3, 2026 20:10
@joaodinissf joaodinissf force-pushed the fix/pmd-public-member-nonpublic-type branch from be5d8c2 to c5c6f96 Compare July 3, 2026 20:32
PMD 7.26.0 tightens two rules that flag pre-existing code, breaking the
maven-pmd-plugin `check` goal:

PublicMemberInNonPublicType -- drop the needless `public` on members of
non-public (anonymous / nested) types:
  * QualifiedNameSegmentTreeLookup visitor overrides -> package-private
    (they override a package-private `Visitor.visit(SegmentNode)`).
  * ScopingGeneratorUtil / ExportGeneratorSupport `allPackages()` overrides
    and AbstractFragmentProviderTest's `appendEscaped`/`unescape` test hooks
    -> protected (the overridden framework methods are themselves protected;
    the migration had needlessly widened them to public).

AssertEqualsArgumentOrder -- put expected before actual in five assertEquals
calls across the test bundles (BasicModelTest, AbstractValidationTest,
AbstractQuickFixTest, AbstractFragmentProviderTest,
QualifiedNameSegmentTreeLookupTest). Behaviour-preserving; only corrects the
expected/actual reporting order.

Verified with a full `clean verify ... pmd:check spotbugs:check` under
-Dpmd.version=7.26.0 (compiles first, so PMD gets real type resolution):
BUILD SUCCESS, 0 violations, 64 modules.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@joaodinissf joaodinissf force-pushed the fix/pmd-public-member-nonpublic-type branch from c5c6f96 to 6a3be72 Compare July 3, 2026 20:58
@joaodinissf joaodinissf changed the title fix: package-private visit() overrides in QualifiedNameSegmentTreeLookup (unblocks PMD 7.26.0) fix: satisfy PMD 7.26.0 across the reactor (visibility + assertEquals order) Jul 3, 2026
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