ChangeInfo: change _number from int to Integer

In the ChangeInfoDiffer, fields that don't differ between two
ChangeInfos should return null. However, _number is returning 0 when
that is the case because it's a primitive which has the default value 0.
This is causing _number to be returned in every request to the gREST API
Change's meta_diff.

Change-Id: I425600c63726fcdf4f2bba489264954c8fbc1e1d
Signed-off-by: Alex Spradlin <alexaspradlin@google.com>
This commit is contained in:
Alex Spradlin
2021-04-01 10:47:45 -07:00
parent d10737dac6
commit 1d76f564f6
2 changed files with 3 additions and 1 deletions

View File

@@ -91,7 +91,7 @@ public class ChangeInfo {
*/
public Boolean containsGitConflicts;
public int _number;
public Integer _number;
public AccountInfo owner;

View File

@@ -37,6 +37,7 @@ public final class ChangeInfoDifferTest {
ChangeInfoDifference diff = ChangeInfoDiffer.getDifference(new ChangeInfo(), new ChangeInfo());
// Spot check a few fields, including collections and maps.
assertThat(diff.added()._number).isNull();
assertThat(diff.added().branch).isNull();
assertThat(diff.added().project).isNull();
assertThat(diff.added().currentRevision).isNull();
@@ -44,6 +45,7 @@ public final class ChangeInfoDifferTest {
assertThat(diff.added().messages).isNull();
assertThat(diff.added().reviewers).isNull();
assertThat(diff.added().hashtags).isNull();
assertThat(diff.removed()._number).isNull();
assertThat(diff.removed().branch).isNull();
assertThat(diff.removed().project).isNull();
assertThat(diff.removed().currentRevision).isNull();