You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2011/06/12 10:11:51 UTC

svn commit: r1134886 - /maven/maven-3/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java

Author: hboutemy
Date: Sun Jun 12 08:11:51 2011
New Revision: 1134886

URL: http://svn.apache.org/viewvc?rev=1134886&view=rev
Log:
improved documentation to precise sorting of unknown qualifiers

Modified:
    maven/maven-3/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java

Modified: maven/maven-3/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java?rev=1134886&r1=1134885&r2=1134886&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java (original)
+++ maven/maven-3/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java Sun Jun 12 08:11:51 2011
@@ -30,15 +30,17 @@ import java.util.Properties;
 import java.util.Stack;
 
 /**
- * Generic implementation of version comparison. Features:
+ * Generic implementation of version comparison.
+ * 
+ * <p>Features:
  * <ul>
  * <li>mixing of '<code>-</code>' (dash) and '<code>.</code>' (dot) separators,</li>
  * <li>transition between characters and digits also constitutes a separator:
  *     <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>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):<ul>
+ *     Well-known qualifiers (case insensitive) are:<ul>
  *     <li><code>snapshot</code></li>
  *     <li><code>alpha</code> or <code>a</code></li>
  *     <li><code>beta</code> or <code>b</code></li>
@@ -47,11 +49,12 @@ import java.util.Stack;
  *     <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 dash usually precedes a qualifier, and is always less important than something preceded with a dot.</li>
- * </ul>
+ * </ul></p>
  *
- * @see <a href="http://docs.codehaus.org/display/MAVEN/Versioning">"Versioning" on Maven Wiki</a>
+ * @see <a href="https://cwiki.apache.org/confluence/display/MAVENOLD/Versioning">"Versioning" on Maven Wiki</a>
  * @author <a href="mailto:kenney@apache.org">Kenney Westerhof</a>
  * @author <a href="mailto:hboutemy@apache.org">Hervé Boutemy</a>
  */
@@ -198,8 +201,7 @@ public class ComparableVersion
         /**
          * Returns a comparable value for a qualifier.
          *
-         * This method both takes into account the ordering of known qualifiers as well as lexical ordering for unknown
-         * qualifiers.
+         * This method takes into account the ordering of known qualifiers then unknown qualifiers with lexical ordering.
          *
          * just returning an Integer with the index here is faster, but requires a lot of if/then/else to check for -1
          * or QUALIFIERS.size and then resort to lexical ordering. Most comparisons are decided by the first character,
@@ -212,7 +214,7 @@ public class ComparableVersion
         {
             int i = _QUALIFIERS.indexOf( qualifier );
 
-            return i == -1 ? _QUALIFIERS.size() + "-" + qualifier : String.valueOf( i );
+            return i == -1 ? ( _QUALIFIERS.size() + "-" + qualifier ) : String.valueOf( i );
         }
 
         public int compareTo( Item item )