diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java b/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java
index 73989344a5..01cb0d76a5 100644
--- a/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java
+++ b/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java
@@ -30,8 +30,28 @@ import java.util.Properties;
import java.util.Stack;
/**
- * Generic implementation of version comparison.
+ * Generic implementation of version comparison. Features:
+ *
+ * - mixing of '
-
' (dash) and '.
' (dot) separators,
+ * - transition between characters and digits also constitutes a separator:
+ *
1.0alpha1 => [1, 0, alpha, 1]
+ * - unlimited number of version components,
+ * - version components in the text can be digits or strings
+ * - strings are checked for well-known qualifiers and the qualifier ordering is used for version ordering.
+ * Well-known qualifiers (case insensitive):
+ * snapshot
+ * alpha
or a
+ * beta
or b
+ * milestone
or m
+ * rc
or cr
+ * (the empty string)
or ga
or final
+ * sp
+ *
+ *
+ * - a dash usually precedes a qualifier, and is always less important than something preceded with a dot.
+ *
*
+ * @see "Versioning" on Maven Wiki
* @author Kenney Westerhof
* @author Herve Boutemy
* @version $Id$
@@ -279,21 +299,21 @@ public class ComparableVersion
case LIST_ITEM:
Iterator left = iterator();
Iterator right = ( (ListItem) item ).iterator();
-
+
while ( left.hasNext() || right.hasNext() )
{
Item l = left.hasNext() ? (Item) left.next() : null;
Item r = right.hasNext() ? (Item) right.next() : null;
-
+
// if this is shorter, then invert the compare and mul with -1
int result = l == null ? -1 * r.compareTo( l ) : l.compareTo( r );
-
+
if ( result != 0 )
{
return result;
}
}
-
+
return 0;
default:
@@ -370,7 +390,7 @@ public class ComparableVersion
if ( isDigit )
{
list.normalize(); // 1.0-* = 1-*
-
+
if ( ( i + 1 < version.length() ) && Character.isDigit( version.charAt( i + 1 ) ) )
{
// new ListItem only if previous were digits and new char is a digit,