You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/12/21 09:52:29 UTC

[GitHub] [maven] michael-o commented on a diff in pull request #930: [MNG-7644] Fix version comparison ( .X1 < -X2 for any string qualifier x ), 3.8.x branch

michael-o commented on code in PR #930:
URL: https://github.com/apache/maven/pull/930#discussion_r1054191144


##########
maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java:
##########
@@ -337,4 +337,20 @@ public void testReuse()
 
         assertEquals( "reused instance should be equivalent to new instance", c1, c2 );
     }
+
+    /**
+     * Test <a href="https://issues.apache.org/jira/browse/MNG-7644">MNG-7644</a> edge cases
+     * 1.0.0.RC1 < 1.0.0-RC2
+     */
+    public void testMng7644()
+    {
+        for ( String x : new String[]{ "alpha", "a", "beta", "b", "milestone", "m", "RC" } ) {

Review Comment:
   You should add at least two arbitrary one as well.



##########
maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java:
##########
@@ -53,7 +53,8 @@
  *     </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>a hyphen usually precedes a qualifier, and is always less important than digits/number, for example
+ *   1.0.RC2 &lt; 1.0-RC3 &lt; 1.0.1 ; but prefer '1.0.0-RC1' over '1.0.0.RC1' </li>

Review Comment:
   This needs to be generalized as well.



##########
maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java:
##########
@@ -337,4 +337,20 @@ public void testReuse()
 
         assertEquals( "reused instance should be equivalent to new instance", c1, c2 );
     }
+
+    /**
+     * Test <a href="https://issues.apache.org/jira/browse/MNG-7644">MNG-7644</a> edge cases
+     * 1.0.0.RC1 < 1.0.0-RC2

Review Comment:
   This needs to be generalized as well.



-- 
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-unsubscribe@maven.apache.org

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