diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-08-09 01:01:27 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-08-09 01:49:56 +0200 |
commit | bac0e8fd8d7b8a5b70009346d3ccbd5f2a3a2a5b (patch) | |
tree | f1ddfabfd9e4347fe961aa5cce28f0cfdfdfddaf /org.eclipse.jgit.lfs | |
parent | 8f7e8513463487cfbcd41e40a684abec9ec10778 (diff) | |
download | jgit-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.java | 4 |
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 |