diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2010-08-15 23:12:58 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2010-08-15 23:12:58 +0200 |
commit | 2d3a806271ee5b9bb66e32f2aa934b36be7b1408 (patch) | |
tree | 8119370583121cd45de321f82c90b77d302bf027 /org.eclipse.jgit/src/org/eclipse | |
parent | 8d761febc3dd3fc3e0258a17526f6479757637f6 (diff) | |
download | jgit-2d3a806271ee5b9bb66e32f2aa934b36be7b1408.tar.gz jgit-2d3a806271ee5b9bb66e32f2aa934b36be7b1408.zip |
Backout RevObject's object-identity based equals implementation
This restores the transitivity and symmetry properties of the equals
methods on the AnyObjectId type hierarchy as defined in [1].
Following [2] we declare these equals methods final to ensure that
semantics of equals are consistent across AnyObjectId's type hierarchy.
[1] http://download-llnw.oracle.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)
[2] http://www.angelikalanger.com/Articles/JavaSolutions/SecretsOfEquals/Equals.html
Bug: 321502
Change-Id: Ibace21fa268c4aa15da6c65d42eb705ab1aa24b3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java | 4 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java | 10 |
2 files changed, 2 insertions, 12 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 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. * |