GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] Reset CPD constructor detection for each file by noor-ahmadi · Pull Request #7138 · pmd/pmd

Conversation

@noor-ahmadi

@noor-ahmadi noor-ahmadi commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Describe the PR

The constructor detector was kept around when CPD moved to another file so its old state could affect the next one. It now starts fresh for each file which fixes the crash with --ignore-identifiers.

Added tests for the three file case in the issue and a case where an identifier in a later file was being treated as a constructor. Both compare the reused lexer with a fresh lexer.

This touches the detector setup that #6215 also changes so that part may need adjusting if it lands first.

ran ./mvnw -B -ntp -pl pmd-java -am clean verify with Java 21. 16,774 tests with 32 skipped and no failures or errors. Both new tests failed before the fix.

Related issues

  • Fix [java] CPD: Constructor detection state leaks between files with --ignore-identifiers #7133

Ready?

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@noor-ahmadi
[java] Reset CPD constructor detection for each file
ec0c7c3
@pmd-actions-helper

pmd-actions-helper Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-10-03 08:58:33+00:00 for ec0c7c3)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@UncleOwen UncleOwen added this to the 7.29.0 milestone Oct 4, 2026
UncleOwen
UncleOwen approved these changes Oct 4, 2026
View reviewed changes

@UncleOwen UncleOwen left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@UncleOwen
UncleOwen merged commit 6d2e23a into pmd:main Oct 4, 2026
13 checks passed

Uh oh!

There was an error while loading. Please reload this page.

turbospaces added a commit to codiqo/codiqo that referenced this pull request Oct 5, 2026
@turbospaces @claude
Move to PMD 7.29.0-SNAPSHOT for the CPD lexer fix and drop the batch-…
fe10698
…retry workaround

pmd/pmd#7138 (merged for 7.29.0) makes JavaCpdLexer start a fresh ConstructorDetector for every
file. Before it, the detector leaked state across files, and a large enough file set (micronaut-core,
spring-framework) crashed CPD with an NPE that named no file.

- pmd.version is 7.29.0-SNAPSHOT, resolved from the Central snapshots repository, which is added to
  both <repositories> and <pluginRepositories> (maven-pmd-plugin is pinned to ${pmd.version}). Both
  blocks are temporary and go once PMD 7.29.0 is released (milestone due 2026-10-30).
- The CPD batch retry existed only for that crash and is removed together with CpdBatchRetryTest.
  CPD again runs once over every file of a language, so clones spanning what used to be two retry
  batches are no longer lost.

Consumers need no change: codiqo itself is published to the same snapshots repository, which they
already list as both a repository and a plugin repository.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
turbospaces added a commit to codiqo/codiqo that referenced this pull request Oct 30, 2026
@turbospaces @claude
Move PMD to the 7.29.0 release and bump dependencies to their latest …
4f1d67e
…stable releases

PMD 7.29.0 carries pmd/pmd#7138, the CPD lexer fix the floating
7.29.0-SNAPSHOT was used for, so the temporary central-snapshots
repository and plugin repository are removed with it.

JaCoCo 0.8.16 adds official Java 27 support. It is also the agent version
codiqo attaches to the builds it analyses.

openai-java moves from 4.91.0 to 4.94.0, with no breaking changes listed.
ClassGraph stays on 4.8.199, the latest 4.x: 6.0.1 is JDK 25 bytecode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@UncleOwen UncleOwen UncleOwen approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

7.29.0

Development

Successfully merging this pull request may close these issues.

[java] CPD: Constructor detection state leaks between files with --ignore-identifiers

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@noor-ahmadi @UncleOwen
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.