AccountDelta: Add @CanIgnoreReturnValue to Builder methods that return the Builder
These methods return the Builder instance to support chaining calls.
It's OK for callers to ignore the return value.
Release-Notes: skip
Change-Id: I5f37e7fa77f47c50f98c26a456bf94b210575deb
Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/java/com/google/gerrit/server/account/AccountDelta.java b/java/com/google/gerrit/server/account/AccountDelta.java
index 30f879e..f074522 100644
--- a/java/com/google/gerrit/server/account/AccountDelta.java
+++ b/java/com/google/gerrit/server/account/AccountDelta.java
@@ -18,6 +18,7 @@
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.entities.Account;
import com.google.gerrit.entities.NotifyConfig.NotifyType;
@@ -191,6 +192,7 @@
*
* @param fullName the new full name, if {@code null} or empty string the full name is unset
*/
+ @CanIgnoreReturnValue
public abstract Builder setFullName(@Nullable String fullName);
/**
@@ -199,6 +201,7 @@
* @param displayName the new display name, if {@code null} or empty string the display name is
* unset
*/
+ @CanIgnoreReturnValue
public abstract Builder setDisplayName(@Nullable String displayName);
/**
@@ -207,6 +210,7 @@
* @param preferredEmail the new preferred email, if {@code null} or empty string the preferred
* email is unset
*/
+ @CanIgnoreReturnValue
public abstract Builder setPreferredEmail(@Nullable String preferredEmail);
/**
@@ -215,6 +219,7 @@
* @param active {@code true} if the account should be set to active, {@code false} if the
* account should be set to inactive
*/
+ @CanIgnoreReturnValue
public abstract Builder setActive(boolean active);
/**
@@ -222,6 +227,7 @@
*
* @param status the new status, if {@code null} or empty string the status is unset
*/
+ @CanIgnoreReturnValue
public abstract Builder setStatus(@Nullable String status);
/**
@@ -243,6 +249,7 @@
* @param extId external ID that should be added
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder addExternalId(ExternalId extId) {
return addExternalIds(ImmutableSet.of(extId));
}
@@ -259,6 +266,7 @@
* @param extIds external IDs that should be added
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder addExternalIds(Collection<ExternalId> extIds) {
createdExternalIdsBuilder().addAll(extIds);
return this;
@@ -282,6 +290,7 @@
* @param extId external ID that should be updated
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder updateExternalId(ExternalId extId) {
return updateExternalIds(ImmutableSet.of(extId));
}
@@ -298,6 +307,7 @@
* @param extIds external IDs that should be updated
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder updateExternalIds(Collection<ExternalId> extIds) {
updatedExternalIdsBuilder().addAll(extIds);
return this;
@@ -321,6 +331,7 @@
* @param extId external ID that should be deleted
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder deleteExternalId(ExternalId extId) {
return deleteExternalIds(ImmutableSet.of(extId));
}
@@ -336,6 +347,7 @@
* @param extIds external IDs that should be deleted
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder deleteExternalIds(Collection<ExternalId> extIds) {
deletedExternalIdsBuilder().addAll(extIds);
return this;
@@ -348,6 +360,7 @@
* @param extIdToAdd external ID that should be added
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder replaceExternalId(ExternalId extIdToDelete, ExternalId extIdToAdd) {
return replaceExternalIds(ImmutableSet.of(extIdToDelete), ImmutableSet.of(extIdToAdd));
}
@@ -359,6 +372,7 @@
* @param extIdsToAdd external IDs that should be added
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder replaceExternalIds(
Collection<ExternalId> extIdsToDelete, Collection<ExternalId> extIdsToAdd) {
return deleteExternalIds(extIdsToDelete).addExternalIds(extIdsToAdd);
@@ -380,6 +394,7 @@
* @param notifyTypes the notify types that should be set for the project watch
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder updateProjectWatch(
ProjectWatchKey projectWatchKey, Set<NotifyType> notifyTypes) {
return updateProjectWatches(ImmutableMap.of(projectWatchKey, notifyTypes));
@@ -394,6 +409,7 @@
* @param projectWatches project watches that should be updated
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder updateProjectWatches(Map<ProjectWatchKey, Set<NotifyType>> projectWatches) {
updatedProjectWatchesBuilder().putAll(projectWatches);
return this;
@@ -414,6 +430,7 @@
* @param projectWatch project watch that should be deleted
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder deleteProjectWatch(ProjectWatchKey projectWatch) {
return deleteProjectWatches(ImmutableSet.of(projectWatch));
}
@@ -426,6 +443,7 @@
* @param projectWatches project watches that should be deleted
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder deleteProjectWatches(Collection<ProjectWatchKey> projectWatches) {
deletedProjectWatchesBuilder().addAll(projectWatches);
return this;
@@ -439,6 +457,7 @@
* @param generalPreferences the general preferences that should be set
* @return the builder
*/
+ @CanIgnoreReturnValue
public abstract Builder setGeneralPreferences(GeneralPreferencesInfo generalPreferences);
/**
@@ -449,6 +468,7 @@
* @param diffPreferences the diff preferences that should be set
* @return the builder
*/
+ @CanIgnoreReturnValue
public abstract Builder setDiffPreferences(DiffPreferencesInfo diffPreferences);
/**
@@ -459,8 +479,10 @@
* @param editPreferences the edit preferences that should be set
* @return the builder
*/
+ @CanIgnoreReturnValue
public abstract Builder setEditPreferences(EditPreferencesInfo editPreferences);
+ @CanIgnoreReturnValue
public abstract Builder setShouldDeleteAccount(boolean shouldDelete);
/**
@@ -469,6 +491,7 @@
* @param extIdsToDelete external IDs that should be deleted
* @return the builder
*/
+ @CanIgnoreReturnValue
public Builder deleteAccount(Collection<ExternalId> extIdsToDelete) {
deleteExternalIds(extIdsToDelete);
setShouldDeleteAccount(true);