michael-o commented on PR #929:
URL: https://github.com/apache/maven/pull/929#issuecomment-1363702902

   > Hi @michael-o if I may, I think the current implementation is in line with 
the specification as I have a feeling that the specification has been based on 
it 😄
   > 
   > The problem is that the spec deviates from SemVer in how it treats 
non-standard qualifiers, like the "pfd" here. According to SemVer, all 
qualifiers should be treated as less than -.number whereas with "the spec" all 
non-standard qualifiers are treated as later than -.number.
   > 
   > As is the case of "-pdf" which is later than the release.
   > 
   > So this:
   > 
   > > The docs say:
   > > > else ".qualifier" = "-qualifier" < "-number" < ".number
   > 
   > is not exactly true.
   > 
   > ```java
   >     @Test
   >     public void testComparableVersionWithCustomQualifier()
   >     {
   >         assertThat( new DefaultArtifactVersion( "2.3" ).compareTo( new 
DefaultArtifactVersion( "2.3-pfd" ) ),
   >                 greaterThan( 0 ) );
   >     }
   > ```
   > 
   > ```
   > java.lang.AssertionError: 
   > Expected: a value greater than <0>
   >      but: <-2> was less than <0>
   > ```
   > 
   > So, adding "pfd" as a recognised qualifier would mean that the spec also 
needs to be updated. Which is why it's a breaking change and not a bugfix.
   > 
   > Frankly, to me it looks like this behaviour contradicts the statement that 
"-qualifier" < "-number", but I've long given up on that.
   
   I have just re-read the spec. It says:
   
       If version strings are syntactically correct [Semantic Versioning 
1.0.0](https://semver.org/spec/v1.0.0.html) version numbers, then in almost all 
cases version comparison follows the precedence rules outlined in that 
specification....Maven does not consider any semantics implied by that 
specification....Non-numeric tokens ("qualifiers") have the alphabetical order, 
except for the following tokens which come first in this order
   
   So what it does is just use the *syntax* of SemVer 1.0 and *not* the 
semantics. It considers only a new qualifiers as pre-release and not all, e.g., 
sp for service pack is a post-GA qualifier. So to me this change is change of 
the specs since it wants add more qualifiers to the pre-release state.
   So my verdict based on my understanding the dot vs hyphen issue was real and 
I can see it with a few manual tests. Others are not.
   
   I will remove this ticket from 3.x for obvious reasons. I think that the 
version scheme requires an update in 4.0, but that is a different discussion.
   
   Opinions?
   
   Side note:
   Looking at SemVer 2.0 I am not really happy with it:
   * It allows very complex qualifiers. Don't know wether that is really 
necessary
   * Our `SNAPSHOT` qualifier cannot be covered
   * Build qualfiiers aren't release qualifiers for me
   * I don't see how one can map custom qualifiers (post-release) for the case 
I have depicted earlier, those aren't build qualifiers.
   * I don't see how a build qualifier makes sense after post-release where a 
release is supposed to be immutable and identical according to SemVer
   
   PS: I am not happy with the ambiguity/lack of precision of the current spec


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to