Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve version comparison when number of version "segments" are different #45

Closed
sleberknight opened this issue Mar 18, 2020 · 0 comments · Fixed by #547
Closed

Improve version comparison when number of version "segments" are different #45

sleberknight opened this issue Mar 18, 2020 · 0 comments · Fixed by #547
Assignees
Labels
enhancement A request for change or improvement to an existing feature
Milestone

Comments

@sleberknight
Copy link
Member

Current implementation works best when versions have the same number of segments, e.g. 2.1.0 vs 2.0.0 and 1.5.0-SNAPSHOT vs 1.6.0-SNAPSHOT.

It works also when different number of segments when different segments are numeric, e.g. 1.0.0 vs 1.0.0.42.

It does NOT work so well right now when the last different segments are non-numeric, e.g. 1.0.0 vs 1.0.0-SNAPSHOT or 1.0.0-alpha. Currently, 1.0.0-SNAPSHOT and 1.0.0-alpha are considered higher versions than 1.0.0, which is not correct generally speaking.

Finally, it will not work very well comparing things like 1.0.0-alpha and 1.0.0-beta with 1.0.0.Final.

@sleberknight sleberknight added the enhancement A request for change or improvement to an existing feature label Apr 27, 2020
@sleberknight sleberknight self-assigned this Apr 13, 2021
@sleberknight sleberknight added the in progress A task that is actively being worked on label Apr 13, 2021
@sleberknight sleberknight added this to the 0.23.0 milestone Apr 13, 2021
sleberknight added a commit that referenced this issue Apr 14, 2021
* Make entire version comparison case-insensitive
* Update Versions#versionCompare to handle cases in which versions
  contain things like SNAPSHOT, alpha1, beta3, M1 etc.
* Extract some methods to keep versionCompare relatively clean
* Revise javadocs for Versions#versionCompare
* Add a bunch of additional test expectations with versions from
  libraries we use such as Guava, Spring (w/ RELEASE naming convention),
  Jetty (old convention with yyyymmdd), JUnit with M1, M2, etc. as well
  as a bunch of other commonly seen situations that ought to cover the
  majority of real-world situations.

Closes #45
sleberknight added a commit that referenced this issue Apr 14, 2021
…nt (#547)

* Make entire version comparison case-insensitive
* Update Versions#versionCompare to handle cases in which versions
  contain things like SNAPSHOT, alpha1, beta3, M1 etc.
* Extract some methods to keep versionCompare relatively clean
* Revise javadocs for Versions#versionCompare
* Add a bunch of additional test expectations with versions from
  libraries we use such as Guava, Spring (w/ RELEASE naming convention),
  Jetty (old convention with yyyymmdd), JUnit with M1, M2, etc. as well
  as a bunch of other commonly seen situations that ought to cover the
  majority of real-world situations.

Closes #45
@sleberknight sleberknight removed the in progress A task that is actively being worked on label Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A request for change or improvement to an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant