[ 
https://issues.apache.org/jira/browse/MNG-7559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17649845#comment-17649845
 ] 

ASF GitHub Bot commented on MNG-7559:
-------------------------------------

sultan commented on code in PR #929:
URL: https://github.com/apache/maven/pull/929#discussion_r1053459303


##########
maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java:
##########
@@ -40,22 +41,39 @@
  *     <code>1.0alpha1 =&gt; [1, 0, alpha, 1]</code></li>
  * <li>unlimited number of version components,</li>
  * <li>version components in the text can be digits or strings,</li>
- * <li>strings are checked for well-known qualifiers and the qualifier 
ordering is used for version ordering.
- *     Well-known qualifiers (case insensitive) are:<ul>
- *     <li><code>alpha</code> or <code>a</code></li>
- *     <li><code>beta</code> or <code>b</code></li>
- *     <li><code>milestone</code> or <code>m</code></li>
- *     <li><code>rc</code> or <code>cr</code></li>
- *     <li><code>snapshot</code></li>
- *     <li><code>(the empty string)</code> or <code>ga</code> or 
<code>final</code></li>
- *     <li><code>sp</code></li>
- *     </ul>
- *     Unknown qualifiers are considered after known qualifiers, with lexical 
order (always case insensitive),
- *   </li>
- * <li>a hyphen usually precedes a qualifier, and is always less important 
than something preceded with a dot.</li>
+ * <li>
+ *   String qualifiers are ordered lexically (case insensitive), with the 
following exceptions:
+ *   <ul>
+ *     <li> 'snapshot' &lt; '' &lt; 'sp' </li>
+ *   </ul>
+ *   and alias -&gt; replacement (all case insensitive):
+ *   <ul>
+ *     <li> 'a' -&gt; 'alpha' </li>
+ *     <li> 'b' -&gt; 'beta' </li>
+ *     <li> 'm' -&gt; 'milestone' </li>
+ *     <li> 'cr' -&gt; 'rc' </li>
+ *     <li> 'final' -&gt; '' </li>
+ *     <li> 'final' -&gt; '' </li>
+ *     <li> 'final' -&gt; '' </li>
+ *   </ul>

Review Comment:
   trying to show and explain why there is hard coded qualifiers. the current 
version took the form it has following change requests from elharo. any other 
form is good to me.





> ComparableVersion vs versions with custom qualifiers
> ----------------------------------------------------
>
>                 Key: MNG-7559
>                 URL: https://issues.apache.org/jira/browse/MNG-7559
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.8.3
>            Reporter: Andrzej Jarmoniuk
>            Assignee: Michael Osipov
>            Priority: Major
>             Fix For: 3.8.x-candidate, 3.9.0, 4.0.0, 4.0.0-alpha-3, 
> 4.0.0-alpha-4
>
>         Attachments: image-2022-10-22-18-22-11-591.png
>
>
> Since I know that ComparableVersion was brought to Maven from 
> versions-maven-plugin, it turns out the bug described here:
> https://github.com/mojohaus/versions-maven-plugin/issues/744
> also exists in maven, at least in 3.8.3.
> According to the maven version spec, versions containing a qualifier should 
> be treated as less major than the same versions without the qualifier. 
> Currently it's only the case for a few "standard" qualifiers, e.g. "-rc*", 
> "-alpha", etc.
> However, it looks like "2.3-pfd" is deemed less major than "2.3".
> {code:java}
>     @Test
>     public void testComparableVersionWithCustomQualifier()
>     {
>         assertThat( new ComparableVersion( "2.3" ).compareTo( new 
> ComparableVersion( "2.3-pfd" ) ),
>                 greaterThan( 0 ) );
>     }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to