[MNG-8450] Report BOM import warnings only at declaration sites - #12959
[MNG-8450] Report BOM import warnings only at declaration sites#12959goutamadwant wants to merge 2 commits into
Conversation
Signed-off-by: goutamadwant <workwithgoutam@gmail.com>
Signed-off-by: goutamadwant <workwithgoutam@gmail.com>
gnodet
left a comment
There was a problem hiding this comment.
✅ Well-Designed Warning Deduplication
Solid fix for BOM import warning spam. The deduplication-by-declaration-site approach is clean, thread safety is correctly handled (ConcurrentHashMap.newKeySet() for dedup, ConcurrentHashMap for reactor collector lookup, CopyOnWriteArrayList/AtomicInteger/LongAdder in ProblemCollector.Impl), and state lifecycle is well-managed (deriveTopLevel() creates fresh dedup sets, loadFromRoot clears on reactor-root fallback).
Test coverage is thorough — serial and parallel builds, reactor and non-reactor parents, independent declarations, profile-activated imports, and repeated session builds.
Minor polish suggestions (non-blocking):
-
Fully-qualified
Collectors—DefaultModelBuilderTest.javausesjava.util.stream.Collectorsfully qualified in two places whilejava.util.stream.Streamis already imported. Adding the import would be consistent. -
Javadoc on
ImportWarningKey— The new record atDefaultModelBuilder.java:684would benefit from a brief comment explaining its role in deduplication. -
Dual-key rationale in
registerReactorProblemCollector—source.getLocation()(path form) andsource.getPath().toUri().toString()(URI form) are registered as two separate keys. The dual-key approach works as a safety net, but a brief comment explaining the rationale would help future maintainers. -
Anonymous collector extraction — The anonymous
ModelProblemCollectorindeduplicatingImportProblemCollector()delegates 7 methods. Consider extracting it as a named inner class for readability.
Note: The "Core IT suite has been run successfully" checkbox in the PR description is unchecked — maintainers may want confirmation before merging.
📋 PR Metadata
| Aspect | Current | Suggested |
|---|---|---|
| Labels | (none) | enhancement |
| Milestone | (none) | 4.1.0 |
🔀 Backport Status
✅ Not needed — the V40 warning was introduced in Maven 4.0, so this fix correctly targets master only.
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
Fixes #10179
Summary
Report conflicting BOM import warnings once at the model that declares the imports instead of repeating them for every inheriting child.
Implementation
Verification
mvn --batch-mode verifymaven-implverification: 613 tests passed, 4 skippedFollowing this checklist to help us incorporate your contribution quickly and easily:
mvn verifypasses.