Fix: make ProjectIndex thread-safe for parallel builds (backport #12832) - #12927
Merged
Conversation
Backport of #12832 to maven-3.10.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>
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.10.x. The adaptation is correct — on master a null guard already existed and was only enhanced, whereas on maven-3.10.x the code had bare auto-unboxing with no null guard, so introducing both the ConcurrentHashMap switch and the full null guards from scratch is the right approach.
Observations (informational):
- File paths correctly use the
maven-3.10.xlayout (maven-core/...) rather than the master layout (impl/maven-core/...) - The
Integer idx+ null check +int index = idxpattern correctly prevents NPE from auto-unboxing - 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
1 task
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.10.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