]> source.dussan.org Git - jgit.git/commitdiff
Permit AnyObjectTo to compareTo AnyObjectId 26/1026/1
authorShawn O. Pearce <spearce@spearce.org>
Thu, 1 Jul 2010 02:07:36 +0000 (19:07 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 1 Jul 2010 02:07:36 +0000 (19:07 -0700)
Assume that the argument of compareTo won't be mutated while we
are doing the compare, and support the wider AnyObjectId type so
MutableObjectId is suitable on either side of the compareTo call.

Change-Id: I2a63a496c0a7b04f0e5f27d588689c6d5e149d98
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java

index 7d08f3d4c93874e9e35aa4e625d62c115ca2924e..ecaa82b75a30871d96cdf3c5b655de39877e4481 100644 (file)
@@ -113,7 +113,7 @@ public abstract class AnyObjectId implements Comparable {
         * @return < 0 if this id comes before other; 0 if this id is equal to
         *         other; > 0 if this id comes after other.
         */
-       public int compareTo(final ObjectId other) {
+       public int compareTo(final AnyObjectId other) {
                if (this == other)
                        return 0;
 
@@ -139,7 +139,7 @@ public abstract class AnyObjectId implements Comparable {
        }
 
        public int compareTo(final Object other) {
-               return compareTo(((ObjectId) other));
+               return compareTo(((AnyObjectId) other));
        }
 
        /**