elharo commented on code in PR #1099:
URL: https://github.com/apache/maven/pull/1099#discussion_r1200872369


##########
maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java:
##########
@@ -422,6 +436,106 @@ public String toString() {
         }
     }
 
+    /**
+     * Represents a combination in the version item list.
+     * It is usually a combination of a string and a number, with the string 
first and the number second
+     */
+    private static class CombinationItem implements Item {
+
+        StringItem stringValue;
+
+        Item digitValue;
+
+        CombinationItem(String v) {

Review Comment:
   or version?



##########
maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java:
##########
@@ -422,6 +436,106 @@ public String toString() {
         }
     }
 
+    /**
+     * Represents a combination in the version item list.
+     * It is usually a combination of a string and a number, with the string 
first and the number second
+     */
+    private static class CombinationItem implements Item {
+
+        StringItem stringValue;
+
+        Item digitValue;
+
+        CombinationItem(String v) {
+            int index = 0;
+            for (int i = 0; i < v.length(); i++) {
+                char c = v.charAt(i);
+                if (Character.isDigit(c)) {

Review Comment:
   Please elaborate with reference to the docs. I don't think non-ASCII digits 
are included in maven's version comparison algorithm. Though now that I look at 
it I don't think we say that:
   
   https://maven.apache.org/pom.html
   
   We should probably bring this up on the dev mailing list to see if there are 
any unexpected consequences here of non-ASCII digits. 



##########
maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java:
##########
@@ -199,6 +202,7 @@ public int compareTo(Item item) {
                     return -1;
 
                 case STRING_ITEM:
+                case COMBINATION_ITEM:

Review Comment:
   I don't see the change. Perhaps you need to push the branch.



##########
maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java:
##########
@@ -147,10 +154,10 @@ void testVersionsEqual() {
         checkVersionsEqual("1.0.0x", "1-x");
 
         // aliases
-        checkVersionsEqual("1ga", "1");
-        checkVersionsEqual("1release", "1");
-        checkVersionsEqual("1final", "1");
-        checkVersionsEqual("1cr", "1rc");
+        checkVersionsEqualOrder("1ga", "1");

Review Comment:
   still easier to follow if you add new tests without changing the existing 
test methods. 



-- 
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