summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2019-07-18 16:21:13 +0900
committerMatthias Sohn <matthias.sohn@sap.com>2019-08-08 14:34:24 +0200
commit6370098e54e6d611e5db733862a321eefc1ab3c5 (patch)
tree21aa3c0e23696acfbdf85998ab48f9b6d7d6cea7 /org.eclipse.jgit
parent72ae0892066fb4875136cf77c624194e394c0856 (diff)
downloadjgit-6370098e54e6d611e5db733862a321eefc1ab3c5.tar.gz
jgit-6370098e54e6d611e5db733862a321eefc1ab3c5.zip
MergeAlgorithm: Suppress Error Prone warning about reference equality
Error Prone reports: [ReferenceEquality] Comparison using reference equality instead of value equality The END_EDIT instance is used as a marker, and thus it's OK to use a reference equality comparison. Factor the comparison to a method and add a suppression. Change-Id: I7d9dc1fa21f46c984787056b0b5d163e313026a6 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java
index dd42e43841..a77cb4ffb9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java
@@ -86,6 +86,11 @@ public final class MergeAlgorithm {
private final static Edit END_EDIT = new Edit(Integer.MAX_VALUE,
Integer.MAX_VALUE);
+ @SuppressWarnings("ReferenceEquality")
+ private static boolean isEndEdit(Edit edit) {
+ return edit == END_EDIT;
+ }
+
/**
* Does the three way merge between a common base and two sequences.
*
@@ -145,7 +150,7 @@ public final class MergeAlgorithm {
// iterate over all edits from base to ours and from base to theirs
// leave the loop when there are no edits more for ours or for theirs
// (or both)
- while (theirsEdit != END_EDIT || oursEdit != END_EDIT) {
+ while (!isEndEdit(theirsEdit) || !isEndEdit(oursEdit)) {
if (oursEdit.getEndA() < theirsEdit.getBeginA()) {
// something was changed in ours not overlapping with any change
// from theirs. First add the common part in front of the edit