Correcting BoundArtifact comparison and eliminating incrementSegment #771
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So, I examined BoundArtifactVersion and especially the comparison and tried to rule out/handle all corner cases I could imagine.
The premise for that was that we were still using "-snapshot" to construct the lower bound such that all other versions would naturally (using how the current implementation of the Maven comparison works) be compared as more major. I didn't think this was good enough and implemented the same using BoundArtifact.
So, my idea was to, instead using "-SNAPSHOT" to denote the lowest possible version on a given segment, use a BoundArtifact representing an upper bound on the less major segment.
So, instead of 1.0.0-SNAPSHOT to denote the least possible version of "1.0.0", we could use something like 0.9.9-(infinity) to achieve the same (so, "attack" from the other side).
Because we're not actually using the
incrementSegment
method anymore, I removed that method. The ideal goal would be to make the "Comparator" classes actually implement the interface only, and not do auxiliary things like count segments. But that was not my goal here.This obviously does not need to go into the upcoming release. I've tested it, but maybe we should test it a bit more.