Skip to content

Fix #12589: fix operator precedence for BOM import dependency filtering - #12914

Closed
gnodet wants to merge 1 commit into
maven-4.0.xfrom
fix/12589
Closed

Fix #12589: fix operator precedence for BOM import dependency filtering#12914
gnodet wants to merge 1 commit into
maven-4.0.xfrom
fix/12589

Conversation

@gnodet

@gnodet gnodet commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix operator precedence bug in DefaultModelBuilder.importDependencyManagement() where BOM-type dependencies were always skipped
  • The condition !(pom AND import) OR bom incorrectly evaluates so that bom type dependencies always hit continue
  • Changed to !((pom AND import) OR bom) to correctly skip only non-import, non-BOM dependencies

Test plan

  • mvn test passes in impl/maven-impl module (493 tests, 0 failures)
  • CI passes on all platforms

🤖 Generated with Claude Code

The condition `!("pom".equals(type) && "import".equals(scope)) || "bom".equals(type)`
evaluates as `!(pom AND import) OR bom`, which causes BOM-type dependencies to always
be skipped via `continue`. The intended logic is `!((pom AND import) OR bom)` — skip
anything that is NOT a pom/import and NOT a bom. Fixed by moving the closing parenthesis
to wrap the entire OR expression under the negation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet added this to the 4.0.0-rc-7 milestone Aug 29, 2026
@gnodet gnodet added the bug Something isn't working label Aug 29, 2026
@gnodet

gnodet commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #12722 which fixes the same issue (#12589) more completely — it also updates the validator to accept type=bom for import scope and includes a regression test. Additionally, PR #12722's logic !((pom || bom) && import) is more correct than this PR's !((pom && import) || bom), since the latter would process type=bom entries regardless of scope.

@gnodet gnodet closed this Aug 29, 2026
@github-actions github-actions Bot removed this from the 4.0.0-rc-7 milestone Aug 29, 2026
@gnodet

gnodet commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Reopening: type=bom is a Maven 4 native BOM type that inherently implies import semantics — it should NOT require scope=import. The logic !((pom && import) || bom) is intentionally different from PR #12722's !((pom || bom) && import). Will add a regression test.

@gnodet gnodet reopened this Aug 29, 2026
@gnodet

gnodet commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Closing: will fix PR #12722 directly instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant