Fix: make ProjectIndex thread-safe for parallel builds (backport #12832) - #12928
Merged
Conversation
Backport of #12832 to maven-3.9.x. Switch ProjectIndex backing maps from HashMap to ConcurrentHashMap to fix root cause of index corruption under parallel builds (-T). Add null guards for both index and project lookups with enriched error messages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 task
gnodet
commented
Aug 30, 2026
gnodet
left a comment
Contributor
Author
There was a problem hiding this comment.
Clean backport of #12832 to maven-3.9.x. The adaptation is correct — on master the MojoExecutor already had a basic null check that #12832 enhanced, whereas on maven-3.9.x there was no null check at all (raw auto-unboxing), so the backport correctly introduces the full null guard pattern.
Observations (informational):
- The
ConcurrentHashMapswitch inProjectIndexis identical to the master change and is particularly important on 3.9.x whereprojectIndexis passed as a method parameter and shared across threads - The path difference (
maven-core/vsimpl/maven-core/on master) reflects the expected directory reorganization between branches - All three maintenance branches are covered: #12926 (maven-4.0.x), #12927 (maven-3.10.x), #12928 (maven-3.9.x)
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Backport of #12832 to
maven-3.9.x.ProjectIndexbacking maps fromHashMaptoConcurrentHashMapto fix root cause of index corruption under parallel builds (-T)indicesandprojectslookups with enriched error messages mentioning parallel builds and extensions as possible causesTest plan
🤖 Generated with Claude Code