[MNG-7559] Fix version comparison with case insensitive lexical order#1683
[MNG-7559] Fix version comparison with case insensitive lexical order#1683sultan wants to merge 1 commit into
Conversation
|
pls check the up to date spec for resolver versions: |
|
for reference :
this PR might need to be split into 2 PRs
|
311ee68 to
1db950f
Compare
|
we have to discuss how to address the other discouraged qualifiers used in java ee / jarktaee:
in order to fix all the encountered problems. or state on website/javadoc that this will be a no-fix intend to fix apache/maven#8891 step by step
|
1db950f to
8d9bd92
Compare
8f05f18 to
d9da093
Compare
d9da093 to
790483d
Compare
|
IMPORTANT: https://maven.apache.org/pom.html#Version_Order_Specification is the one and only normative source for maven version comparison. If there are any bugs in this, file them, one issue per bug. However, the default assumption is that if the code or other docs differ from what is described here, then it is the code or other doc that is at fault and needs to be changed. |
elharo
left a comment
There was a problem hiding this comment.
Maven does not, cannot, and will not special case every qualifier any project has ever invented. In particular it does not special case:
- pr
- preview
- pre
- dev
They are treated like any other string as described in https://maven.apache.org/pom.html#Version_Order_Specification
|
Thank you for clarifying the current handling of qualifiers.
Such a statement would help reduce confusion across the ecosystem and promote consistent versioning practices. |
gnodet
left a comment
There was a problem hiding this comment.
AI Review — PR #1683: Fix version comparison with case insensitive lexical order
Hi @sultan, thanks for the effort on improving version comparison!
After reviewing the current state of this PR against master, there are several blockers:
🔴 Merge conflicts — code has been refactored (high)
This PR modifies qualifier constants in GenericVersion.java's Tokenizer inner class, but since April 2026 (commit 283b542), those constants have been extracted to a new public class GenericQualifiers.java. The PR is in a CONFLICTING merge state and targets code that no longer exists on master.
🔴 Maintainer rejected adding new qualifiers (high)
A maintainer (@elharo) has explicitly rejected the addition of "pr", "pre", "preview", and "dev" as special-cased qualifiers via a CHANGES_REQUESTED review, stating: "Maven does not, cannot, and will not special case every qualifier any project has ever invented."
🔴 Renumbering breaks public API (high)
The proposed changes renumber QUALIFIER_ALPHA (-5 → -7), QUALIFIER_BETA (-4 → -6), and QUALIFIER_MILESTONE (-3 → -5). On master, these are now public API constants in GenericQualifiers.java (introduced as @since 2.0.17). Changing their values would be a breaking change for downstream consumers.
⚠️ Commented-out test assertions (medium)
testMng7559 contains three commented-out assertion lines, suggesting incomplete implementation or untested edge cases.
💡 Test method visibility inconsistency (low)
testMng7714 is declared public void while all other test methods in the file use package-private visibility (void).
Given the maintainer's explicit rejection and the fundamental code conflicts, this PR would need a complete rethink to move forward.
🤖 This review was generated by ForgeBot using a maker/checker pattern (reviewer + independent verifier). All findings were independently confirmed.
gnodet
left a comment
There was a problem hiding this comment.
Review Summary
Thanks for the effort on this, @sultan. However, this PR has two independently blocking issues that prevent it from being merged in its current state.
Merge Conflicts (confirmed)
The PR modifies qualifier constants (QUALIFIER_ALPHA, QUALIFIER_BETA, QUALIFIER_MILESTONE) and the QUALIFIERS map inside GenericVersion.java's Tokenizer inner class, but on master these have been extracted to a new public class GenericQualifiers.java (commit 283b542, April 2026). GitHub confirms the merge state is CONFLICTING. The PR would need to be rebased against current master, with changes targeting GenericQualifiers.java instead.
Maintainer Feedback Not Addressed (confirmed)
@elharo submitted an explicit CHANGES_REQUESTED review stating: "Maven does not, cannot, and will not special case every qualifier any project has ever invented. In particular it does not special case: pr, preview, pre, dev." The PR still adds exactly these four qualifiers. This maintainer feedback would need to be addressed before the PR can proceed.
Additional Observations
- Commented-out test assertions in
testMng7559(3 lines) suggest the implementation may not fully handle all stated goals. - Minor style:
testMng7714()usespublic voidwhile all other test methods use package-private visibility. - Some documentation changes (reversing ordering notation in
package-info.java) are cosmetic and add noise to the diff without changing semantics.
Suggestion
Some of the regression tests added (e.g., testMng5568, testMng6572, testMng6964, testMng7644) verify behaviors that should already pass on master. These could be valuable regression tests on their own and might be contributed as a separate, smaller PR.
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 PR description was edited to reflect its latest status:
Recurring issues show that Maven’s current handling of qualifiers is incomplete, impacting multiple companies and users:
display-dependency-updatesversion comparison algorithm bug for-pfdmojohaus/versions#744-preversion suffix as prerelease. dependabot/dependabot-core#10207These issues need to be addressed in Maven Resolver. I am working to encourage Maven to adopt a fix through this PR.
Proposed ordering:
I edited the documentation to discourage the use of certain qualifiers:
Optional inclusions:
As long as discouraged qualifiers continue to be used in practice, tools will still need to support them. Once they are phased out, however, support can be safely dropped.
Another possible direction would be:
Thanks for your input.
Following this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verifyto make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
mvn -Prun-its verify).If your pull request is about ~20 lines of code you don't need to sign an Individual Contributor License Agreement if you are unsure please ask on the developers list.
To make clear that you license your contribution under the Apache License Version 2.0, January 2004 you have to acknowledge this by using the following check-box.