summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-08-09 01:01:27 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-08-09 01:49:56 +0200
commitbac0e8fd8d7b8a5b70009346d3ccbd5f2a3a2a5b (patch)
treef1ddfabfd9e4347fe961aa5cce28f0cfdfdfddaf /org.eclipse.jgit.lfs
parent8f7e8513463487cfbcd41e40a684abec9ec10778 (diff)
downloadjgit-bac0e8fd8d7b8a5b70009346d3ccbd5f2a3a2a5b.tar.gz
jgit-bac0e8fd8d7b8a5b70009346d3ccbd5f2a3a2a5b.zip
[error prone] fix ReferenceEquality warning in static equals methods
Implement a helper method suppressing the ReferenceEquality error prone warning and use it to fix this warning in static equals methods where this comparison is used to implement fast path of static equals implementation. See https://errorprone.info/bugpattern/ReferenceEquality Change-Id: I33538a3406007d24efec3a504e031ca1069572ed Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.lfs')
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java4
1 files changed, 3 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 e6fe7408a8..0a509acb79 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
@@ -50,6 +50,7 @@ import java.nio.ByteBuffer;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.util.NB;
+import org.eclipse.jgit.util.References;
/**
* A (possibly mutable) SHA-256 abstraction.
@@ -76,8 +77,9 @@ public abstract class AnyLongObjectId implements Comparable<AnyLongObjectId> {
*/
public static boolean equals(final AnyLongObjectId firstObjectId,
final AnyLongObjectId secondObjectId) {
- if (firstObjectId == secondObjectId)
+ if (References.isSameObject(firstObjectId, secondObjectId)) {
return true;
+ }
// We test word 2 first as odds are someone already used our
// word 1 as a hash code, and applying that came up with these