Merge branch 'stable-3.9' into stable-3.10
* stable-3.9:
ChangesByProjectCacheImpl: Fix PATCH_SET_ID typo
ChangesByProjectCacheImpl: Remove unused import
ChangesByProjectCacheImpl: Fix typo with originalSubject
Change: Consistently apply @Nullable
Change-Id: Ia3e80a0a5f2177aaa940e0b0e7933abe2340708d
Release-Notes: skip
diff --git a/java/com/google/gerrit/entities/Change.java b/java/com/google/gerrit/entities/Change.java
index fad3aa8..3ad7e03 100644
--- a/java/com/google/gerrit/entities/Change.java
+++ b/java/com/google/gerrit/entities/Change.java
@@ -434,7 +434,7 @@
private Id changeId;
/** ServerId of the Gerrit instance that has created the change */
- private String serverId;
+ @Nullable private String serverId;
/** Globally assigned unique identifier of the change */
private Key changeKey;
@@ -545,7 +545,8 @@
* ServerId of the Gerrit instance that created the change. It could be null when the change is
* not fetched from NoteDb but obtained through protobuf deserialisation.
*/
- public @Nullable String getServerId() {
+ @Nullable
+ public String getServerId() {
return serverId;
}
@@ -607,6 +608,7 @@
return originalSubject != null ? originalSubject : subject;
}
+ @Nullable
public String getOriginalSubjectOrNull() {
return originalSubject;
}
@@ -652,6 +654,7 @@
originalSubject = null;
}
+ @Nullable
public String getSubmissionId() {
return submissionId;
}
@@ -684,6 +687,7 @@
return isAbandoned() || isMerged();
}
+ @Nullable
public String getTopic() {
return topic;
}
@@ -720,10 +724,12 @@
this.revertOf = revertOf;
}
+ @Nullable
public Id getRevertOf() {
return this.revertOf;
}
+ @Nullable
public PatchSet.Id getCherryPickOf() {
return cherryPickOf;
}
diff --git a/java/com/google/gerrit/server/git/ChangesByProjectCacheImpl.java b/java/com/google/gerrit/server/git/ChangesByProjectCacheImpl.java
index 2bbd261..17cc5a0 100644
--- a/java/com/google/gerrit/server/git/ChangesByProjectCacheImpl.java
+++ b/java/com/google/gerrit/server/git/ChangesByProjectCacheImpl.java
@@ -301,7 +301,9 @@
size += JavaWeights.REFERENCE + (c.getTopic() == null ? 0 : c.getTopic().length());
size +=
JavaWeights.REFERENCE
- + (c.getOriginalSubject().equals(c.getSubject()) ? 0 : c.getSubject().length());
+ + (c.getOriginalSubject().equals(c.getSubject())
+ ? 0
+ : c.getOriginalSubject().length());
size +=
JavaWeights.REFERENCE + (c.getSubmissionId() == null ? 0 : c.getSubmissionId().length());
size += JavaWeights.REFERENCE + JavaWeights.BOOLEAN; // isPrivate;
@@ -309,7 +311,7 @@
size += JavaWeights.REFERENCE + JavaWeights.BOOLEAN; // reviewStarted;
size += JavaWeights.REFERENCE + (c.getRevertOf() == null ? 0 : GerritWeights.CHANGE_NUM);
size +=
- JavaWeights.REFERENCE + (c.getCherryPickOf() == null ? 0 : GerritWeights.PACTCH_SET_ID);
+ JavaWeights.REFERENCE + (c.getCherryPickOf() == null ? 0 : GerritWeights.PATCH_SET_ID);
return size;
}
@@ -343,7 +345,7 @@
public static final int KEY_INT = JavaWeights.OBJECT + JavaWeights.INT; // IntKey
public static final int CHANGE_NUM = KEY_INT;
public static final int ACCOUNT_ID = KEY_INT;
- public static final int PACTCH_SET_ID =
+ public static final int PATCH_SET_ID =
JavaWeights.OBJECT
+ (JavaWeights.REFERENCE + GerritWeights.CHANGE_NUM) // PatchSet.Id.changeId
+ JavaWeights.INT; // PatchSet.Id patch_num;