diff options
author | Shawn Pearce <spearce@spearce.org> | 2010-08-18 15:00:33 -0400 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2010-08-18 15:00:33 -0400 |
commit | 9fc2cdadd211ea9d93e96151a3adede4c0575cd4 (patch) | |
tree | b429c1876fc8f87f42be713cdc5942c277f88b5d | |
parent | 11c5c9f73b0a8cd5c18a42298fecac37cc3d2d48 (diff) | |
parent | 2d3a806271ee5b9bb66e32f2aa934b36be7b1408 (diff) | |
download | jgit-9fc2cdadd211ea9d93e96151a3adede4c0575cd4.tar.gz jgit-9fc2cdadd211ea9d93e96151a3adede4c0575cd4.zip |
Merge "Backout RevObject's object-identity based equals implementation"
3 files changed, 7 insertions, 17 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java index d4f289a16b..2b24aa49ad 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java @@ -52,7 +52,7 @@ public class RevObjectTest extends RevWalkTestCase { assertSame(a, a.getId()); } - public void testEqualsIsIdentity() throws Exception { + public void testEquals() throws Exception { final RevCommit a1 = commit(); final RevCommit b1 = commit(); @@ -60,8 +60,8 @@ public class RevObjectTest extends RevWalkTestCase { assertTrue(a1.equals((Object) a1)); assertFalse(a1.equals(b1)); - assertFalse(a1.equals(a1.copy())); - assertFalse(a1.equals((Object) a1.copy())); + assertTrue(a1.equals(a1.copy())); + assertTrue(a1.equals((Object) a1.copy())); assertFalse(a1.equals("")); final RevWalk rw2 = new RevWalk(db); @@ -70,8 +70,8 @@ public class RevObjectTest extends RevWalkTestCase { assertNotSame(a1, a2); assertNotSame(b1, b2); - assertFalse(a1.equals(a2)); - assertFalse(b1.equals(b2)); + assertTrue(a1.equals(a2)); + assertTrue(b1.equals(b2)); assertEquals(a1.hashCode(), a2.hashCode()); assertEquals(b1.hashCode(), b2.hashCode()); 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 ecaa82b75a..aeb0812c4d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java @@ -230,11 +230,11 @@ public abstract class AnyObjectId implements Comparable { * the other id to compare to. May be null. * @return true only if both ObjectIds have identical bits. */ - public boolean equals(final AnyObjectId other) { + public final boolean equals(final AnyObjectId other) { return other != null ? equals(this, other) : false; } - public boolean equals(final Object o) { + public final boolean equals(final Object o) { if (o instanceof AnyObjectId) return equals((AnyObjectId) o); else diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java index a19f4d83ea..85191224df 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java @@ -96,16 +96,6 @@ public abstract class RevObject extends ObjectId { return this; } - @Override - public final boolean equals(final AnyObjectId o) { - return this == o; - } - - @Override - public final boolean equals(final Object o) { - return this == o; - } - /** * Test to see if the flag has been set on this object. * |