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>
This commit is contained in:
parent
72ae089206
commit
6370098e54
|
@ -86,6 +86,11 @@ public MergeAlgorithm(DiffAlgorithm diff) {
|
|||
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 <S extends Sequence> MergeResult<S> merge(
|
|||
// 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
|
||||
|
|
Loading…
Reference in New Issue