diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-08-19 11:50:20 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-08-19 11:50:20 -0700 |
commit | 1c2290c8d6e69b50fa4f474aeb7968cd4f1485b7 (patch) | |
tree | 1ea7e10917038065b4b2801c50edbdf10deebf04 /org.eclipse.jgit | |
parent | 5adcd708e4822f77032ef687ac0a7dbcdc852474 (diff) | |
download | jgit-1c2290c8d6e69b50fa4f474aeb7968cd4f1485b7.tar.gz jgit-1c2290c8d6e69b50fa4f474aeb7968cd4f1485b7.zip |
Make ObjectId.compareTo final
Since equals() is now final and does not permit being overridden,
we should do the same thing with compareTo() to prevent different
subclasses from having different ordering behaviors. This could
lead to the same mess that we had with different equals() behaviors.
Change-Id: I35a849b6efccee5fe74cc5788a3566a1516004b7
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java index bee5ff9ef2..c4c26a28e2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java @@ -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 AnyObjectId other) { + public final int compareTo(final AnyObjectId other) { if (this == other) return 0; @@ -138,7 +138,7 @@ public abstract class AnyObjectId implements Comparable { return NB.compareUInt32(w5, other.w5); } - public int compareTo(final Object other) { + public final int compareTo(final Object other) { return compareTo(((AnyObjectId) other)); } @@ -153,7 +153,7 @@ public abstract class AnyObjectId implements Comparable { * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. */ - public int compareTo(final byte[] bs, final int p) { + public final int compareTo(final byte[] bs, final int p) { int cmp; cmp = NB.compareUInt32(w1, NB.decodeInt32(bs, p)); @@ -186,7 +186,7 @@ public abstract class AnyObjectId implements Comparable { * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. */ - public int compareTo(final int[] bs, final int p) { + public final int compareTo(final int[] bs, final int p) { int cmp; cmp = NB.compareUInt32(w1, bs[p]); |