-
Notifications
You must be signed in to change notification settings - Fork 268
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
Use ComparableVersion from Maven and remove the duplicate #898
Use ComparableVersion from Maven and remove the duplicate #898
Conversation
@slawekjaranowski please review. |
* @param artifactVersion version in a text format | ||
* @param segment most major segment that can change, i.e. <em>not</em> held in place | ||
*/ | ||
public BoundArtifactVersion(String artifactVersion, Segment segment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is the key method, I guess...
Hope this is clear, looks a bit like first year's comp-sci exercise, but we're simply parsing the version and splitting it to tokens upon:
- a change from numbers to letters or vice-versa
- an - character
- a dot
The newly constructed version will have Inetger.MAX_VALUE on all places less than the fixed segment. Also, all non-strandard tokens will be replaced by zeros (like in the old impl).
1d94d5a
to
507d897
Compare
@slawekjaranowski please review |
### What changes were proposed in this pull request? This pr aims upgrade `versions-maven-plugin` to 2.15.0 ### Why are the changes needed? New version bring some improvements like: - mojohaus/versions#898 - mojohaus/versions#883 - mojohaus/versions#878 - mojohaus/versions#893 and some bug fix: - mojohaus/versions#901 - mojohaus/versions#897 - mojohaus/versions#891 The full release notes as follows: - https://github.com/mojohaus/versions/releases/tag/2.15.0 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? - GA `Dependencies test` should work normally - Manually check `./dev/test-dependencies.sh --replace-manifest`, run successful Closes #40248 from LuciferYang/SPARK-42648. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: Sean Owen <srowen@gmail.com>
Removing the duplicated ComparableVersion, which is also present in Maven.
Because it's removed, I had to rework BoundArtifactVersion a bit. Now it's not "hacking" ComparableVersion anymore, ie, it's no longer using its private implementation to compute compareTo(). Instead, it's construction "infinity-like" version by using Integer.MAX_INT and uses this to do the comparison on the standard DefaultArtifactVersion.
BoundArtifactVersion is also officially, contractually immutable, and because of that, its
parseVersion
method throws an exception and is deprecated.Also, because the ComparableVersion is gone, the cache is also gone, so I've implemented our own, but went a bit further: we're caching DefaultArtifactVersion instead, since it's also (almost) immutable, and we're not using it's only mutating method
parseVersion()
anywhere.On this condition, it's safe to use the cache.