aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2019-08-09 16:06:28 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2019-08-09 16:09:04 +0900
commit13df53c149cc467766514d4ac86c9d26a0287b7a (patch)
treedf936876d1d2cf183aa4ee55a2e1253ce5413339
parent4b9ed3f678b6256082bf5408e7335b885cc114aa (diff)
downloadjgit-13df53c149cc467766514d4ac86c9d26a0287b7a.tar.gz
jgit-13df53c149cc467766514d4ac86c9d26a0287b7a.zip
[error prone] suppress AmbiguousMethodReference in AnyLongObjectId
Move the implementation of the static equals() method to a new method and suppress the error. Deprecate the old method to signal that we intend to remove it in the next major release. See https://errorprone.info/bugpattern/AmbiguousMethodReference Change-Id: I712697a411ab44c6e05ae4604eb2dcb9c0f8abd3 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java
index 0a509acb79..b095d20e63 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java
@@ -74,9 +74,28 @@ public abstract class AnyLongObjectId implements Comparable<AnyLongObjectId> {
* @param secondObjectId
* the second identifier to compare. Must not be null.
* @return true if the two identifiers are the same.
+ * @deprecated use {@link #isEqual(AnyLongObjectId, AnyLongObjectId)}
+ * instead.
*/
+ @Deprecated
+ @SuppressWarnings("AmbiguousMethodReference")
public static boolean equals(final AnyLongObjectId firstObjectId,
final AnyLongObjectId secondObjectId) {
+ return isEqual(firstObjectId, secondObjectId);
+ }
+
+ /**
+ * Compare two object identifier byte sequences for equality.
+ *
+ * @param firstObjectId
+ * the first identifier to compare. Must not be null.
+ * @param secondObjectId
+ * the second identifier to compare. Must not be null.
+ * @return true if the two identifiers are the same.
+ * @since 5.4
+ */
+ public static boolean isEqual(final AnyLongObjectId firstObjectId,
+ final AnyLongObjectId secondObjectId) {
if (References.isSameObject(firstObjectId, secondObjectId)) {
return true;
}
@@ -276,7 +295,7 @@ public abstract class AnyLongObjectId implements Comparable<AnyLongObjectId> {
* the other id to compare to. May be null.
* @return true only if both LongObjectIds have identical bits.
*/
- @SuppressWarnings("NonOverridingEquals")
+ @SuppressWarnings({ "NonOverridingEquals", "AmbiguousMethodReference" })
public final boolean equals(AnyLongObjectId other) {
return other != null ? equals(this, other) : false;
}