Repository navigation
[MNG-8450] Report BOM import warnings only at declaration sites - #12959
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
- Import java.util.stream.Collectors instead of using fully-qualified references - Add Javadoc on ImportWarningKey record explaining its deduplication role - Document dual-key rationale in registerReactorProblemCollector - Extract anonymous ModelProblemCollector to named DeduplicatingImportProblemCollector inner class Signed-off-by: Guillaume Nodet <gnodet@gmail.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [MNG-8450] Report BOM import warnings only at declaration sites Signed-off-by: goutamadwant <workwithgoutam@gmail.com> * [MNG-8450] Handle import warnings without source locations Signed-off-by: goutamadwant <workwithgoutam@gmail.com> * [MNG-8450] Address review feedback: polish deduplication code - Import java.util.stream.Collectors instead of using fully-qualified references - Add Javadoc on ImportWarningKey record explaining its deduplication role - Document dual-key rationale in registerReactorProblemCollector - Extract anonymous ModelProblemCollector to named DeduplicatingImportProblemCollector inner class Signed-off-by: Guillaume Nodet <gnodet@gmail.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Signed-off-by: goutamadwant <workwithgoutam@gmail.com> Signed-off-by: Guillaume Nodet <gnodet@gmail.com> Co-authored-by: Guillaume Nodet <gnodet@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…) (#13003) * [MNG-8450] Report BOM import warnings only at declaration sites * [MNG-8450] Handle import warnings without source locations * [MNG-8450] Address review feedback: polish deduplication code - Import java.util.stream.Collectors instead of using fully-qualified references - Add Javadoc on ImportWarningKey record explaining its deduplication role - Document dual-key rationale in registerReactorProblemCollector - Extract anonymous ModelProblemCollector to named DeduplicatingImportProblemCollector inner class --------- Signed-off-by: goutamadwant <workwithgoutam@gmail.com> Signed-off-by: Guillaume Nodet <gnodet@gmail.com> Co-authored-by: Goutam Adwant <8672451+goutamadwant@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.