Enable CheckReturnValue for more com.google.gerrit.server packages

Also see change Iaaf598491.

Release-Notes: skip
Bug: Google b/312699566
Change-Id: I41146d81da56db9a97f56c7e734fa576998ee135
Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/java/com/google/gerrit/server/cache/CacheBinding.java b/java/com/google/gerrit/server/cache/CacheBinding.java
index 99db64e..8249948 100644
--- a/java/com/google/gerrit/server/cache/CacheBinding.java
+++ b/java/com/google/gerrit/server/cache/CacheBinding.java
@@ -16,17 +16,21 @@
 
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.Weigher;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import java.time.Duration;
 
 /** Configure a cache declared within a {@link CacheModule} instance. */
 public interface CacheBinding<K, V> {
   /** Set the total size of the cache. */
+  @CanIgnoreReturnValue
   CacheBinding<K, V> maximumWeight(long weight);
 
   /** Set the time an element lives after last write before being expired. */
+  @CanIgnoreReturnValue
   CacheBinding<K, V> expireAfterWrite(Duration duration);
 
   /** Set the time an element lives after last access before being expired. */
+  @CanIgnoreReturnValue
   CacheBinding<K, V> expireFromMemoryAfterAccess(Duration duration);
 
   /**
@@ -34,12 +38,15 @@
    * {@link #expireAfterWrite(Duration)} will still be returned, but on access a task is queued to
    * refresh their value asynchronously.
    */
+  @CanIgnoreReturnValue
   CacheBinding<K, V> refreshAfterWrite(Duration duration);
 
   /** Populate the cache with items from the CacheLoader. */
+  @CanIgnoreReturnValue
   CacheBinding<K, V> loader(Class<? extends CacheLoader<K, V>> clazz);
 
   /** Algorithm to weigh an object with a method other than the unit weight 1. */
+  @CanIgnoreReturnValue
   CacheBinding<K, V> weigher(Class<? extends Weigher<K, V>> clazz);
 
   /**
@@ -47,5 +54,6 @@
    *
    * @see CacheDef#configKey()
    */
+  @CanIgnoreReturnValue
   CacheBinding<K, V> configKey(String configKey);
 }
diff --git a/java/com/google/gerrit/server/cache/CacheModule.java b/java/com/google/gerrit/server/cache/CacheModule.java
index d4e4509..85c5cc56 100644
--- a/java/com/google/gerrit/server/cache/CacheModule.java
+++ b/java/com/google/gerrit/server/cache/CacheModule.java
@@ -18,6 +18,7 @@
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.common.cache.Weigher;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.extensions.annotations.Exports;
 import com.google.gerrit.extensions.config.FactoryModule;
 import com.google.gerrit.server.cache.serialize.JavaCacheSerializer;
@@ -44,6 +45,7 @@
    * @param <V> type of value stored by the cache.
    * @return binding to describe the cache.
    */
+  @CanIgnoreReturnValue
   protected <K, V> CacheBinding<K, V> cache(String name, Class<K> keyType, Class<V> valType) {
     return cache(name, TypeLiteral.get(keyType), TypeLiteral.get(valType));
   }
@@ -55,6 +57,7 @@
    * @param <V> type of value stored by the cache.
    * @return binding to describe the cache.
    */
+  @CanIgnoreReturnValue
   protected <K, V> CacheBinding<K, V> cache(String name, Class<K> keyType, TypeLiteral<V> valType) {
     return cache(name, TypeLiteral.get(keyType), valType);
   }
@@ -66,6 +69,7 @@
    * @param <V> type of value stored by the cache.
    * @return binding to describe the cache.
    */
+  @CanIgnoreReturnValue
   protected <K, V> CacheBinding<K, V> cache(
       String name, TypeLiteral<K> keyType, TypeLiteral<V> valType) {
     CacheProvider<K, V> m = new CacheProvider<>(this, name, keyType, valType);
diff --git a/java/com/google/gerrit/server/cache/CacheProvider.java b/java/com/google/gerrit/server/cache/CacheProvider.java
index 94504b6..41e4bc7 100644
--- a/java/com/google/gerrit/server/cache/CacheProvider.java
+++ b/java/com/google/gerrit/server/cache/CacheProvider.java
@@ -21,6 +21,7 @@
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.Weigher;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.common.Nullable;
 import com.google.gerrit.extensions.annotations.PluginName;
 import com.google.inject.Inject;
@@ -63,6 +64,7 @@
   }
 
   @Override
+  @CanIgnoreReturnValue
   public CacheBinding<K, V> maximumWeight(long weight) {
     checkNotFrozen();
     maximumWeight = weight;
@@ -70,6 +72,7 @@
   }
 
   @Override
+  @CanIgnoreReturnValue
   public CacheBinding<K, V> expireAfterWrite(Duration duration) {
     checkNotFrozen();
     expireAfterWrite = duration;
@@ -77,6 +80,7 @@
   }
 
   @Override
+  @CanIgnoreReturnValue
   public CacheBinding<K, V> expireFromMemoryAfterAccess(Duration duration) {
     checkNotFrozen();
     expireFromMemoryAfterAccess = duration;
@@ -84,6 +88,7 @@
   }
 
   @Override
+  @CanIgnoreReturnValue
   public CacheBinding<K, V> refreshAfterWrite(Duration duration) {
     checkNotFrozen();
     refreshAfterWrite = duration;
@@ -91,6 +96,7 @@
   }
 
   @Override
+  @CanIgnoreReturnValue
   public CacheBinding<K, V> loader(Class<? extends CacheLoader<K, V>> impl) {
     checkNotFrozen();
     loader = module.bindCacheLoader(this, impl);
@@ -98,6 +104,7 @@
   }
 
   @Override
+  @CanIgnoreReturnValue
   public CacheBinding<K, V> weigher(Class<? extends Weigher<K, V>> impl) {
     checkNotFrozen();
     weigher = module.bindWeigher(this, impl);
@@ -105,6 +112,7 @@
   }
 
   @Override
+  @CanIgnoreReturnValue
   public CacheBinding<K, V> configKey(String name) {
     checkNotFrozen();
     configKey = requireNonNull(name);
diff --git a/java/com/google/gerrit/server/cache/PersistentCacheBinding.java b/java/com/google/gerrit/server/cache/PersistentCacheBinding.java
index 5635f44..5a2de69 100644
--- a/java/com/google/gerrit/server/cache/PersistentCacheBinding.java
+++ b/java/com/google/gerrit/server/cache/PersistentCacheBinding.java
@@ -16,26 +16,33 @@
 
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.Weigher;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.server.cache.serialize.CacheSerializer;
 import java.time.Duration;
 
 /** Configure a persistent cache declared within a {@link CacheModule} instance. */
 public interface PersistentCacheBinding<K, V> extends CacheBinding<K, V> {
   @Override
+  @CanIgnoreReturnValue
   PersistentCacheBinding<K, V> maximumWeight(long weight);
 
   @Override
+  @CanIgnoreReturnValue
   PersistentCacheBinding<K, V> expireAfterWrite(Duration duration);
 
   @Override
+  @CanIgnoreReturnValue
   PersistentCacheBinding<K, V> loader(Class<? extends CacheLoader<K, V>> clazz);
 
   @Override
+  @CanIgnoreReturnValue
   PersistentCacheBinding<K, V> expireFromMemoryAfterAccess(Duration duration);
 
   @Override
+  @CanIgnoreReturnValue
   PersistentCacheBinding<K, V> weigher(Class<? extends Weigher<K, V>> clazz);
 
+  @CanIgnoreReturnValue
   PersistentCacheBinding<K, V> version(int version);
 
   /**
@@ -44,9 +51,12 @@
    * <p>If 0 or negative, persistence for the cache is disabled by default, but may still be
    * overridden in the config.
    */
+  @CanIgnoreReturnValue
   PersistentCacheBinding<K, V> diskLimit(long limit);
 
+  @CanIgnoreReturnValue
   PersistentCacheBinding<K, V> keySerializer(CacheSerializer<K> keySerializer);
 
+  @CanIgnoreReturnValue
   PersistentCacheBinding<K, V> valueSerializer(CacheSerializer<V> valueSerializer);
 }
diff --git a/java/com/google/gerrit/server/cache/h2/BUILD b/java/com/google/gerrit/server/cache/h2/BUILD
index 5e64aa7..722bf12 100644
--- a/java/com/google/gerrit/server/cache/h2/BUILD
+++ b/java/com/google/gerrit/server/cache/h2/BUILD
@@ -15,6 +15,7 @@
         "//lib:guava",
         "//lib:h2",
         "//lib:jgit",
+        "//lib/errorprone:annotations",
         "//lib/flogger:api",
         "//lib/guice",
     ],
diff --git a/java/com/google/gerrit/server/cache/h2/package-info.java b/java/com/google/gerrit/server/cache/h2/package-info.java
new file mode 100644
index 0000000..ea541d3
--- /dev/null
+++ b/java/com/google/gerrit/server/cache/h2/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.cache.h2;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/cache/mem/BUILD b/java/com/google/gerrit/server/cache/mem/BUILD
index a666df7..a0cc079 100644
--- a/java/com/google/gerrit/server/cache/mem/BUILD
+++ b/java/com/google/gerrit/server/cache/mem/BUILD
@@ -12,6 +12,7 @@
         "//lib:caffeine-guava",
         "//lib:guava",
         "//lib:jgit",
+        "//lib/errorprone:annotations",
         "//lib/guice",
     ],
 )
diff --git a/java/com/google/gerrit/server/cache/mem/package-info.java b/java/com/google/gerrit/server/cache/mem/package-info.java
new file mode 100644
index 0000000..b8abd10
--- /dev/null
+++ b/java/com/google/gerrit/server/cache/mem/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.cache.mem;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/cache/package-info.java b/java/com/google/gerrit/server/cache/package-info.java
new file mode 100644
index 0000000..4779c73
--- /dev/null
+++ b/java/com/google/gerrit/server/cache/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.cache;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/cache/serialize/BUILD b/java/com/google/gerrit/server/cache/serialize/BUILD
index aa9106b..c77db89 100644
--- a/java/com/google/gerrit/server/cache/serialize/BUILD
+++ b/java/com/google/gerrit/server/cache/serialize/BUILD
@@ -11,5 +11,6 @@
         "//lib:guava",
         "//lib:jgit",
         "//lib:protobuf",
+        "//lib/errorprone:annotations",
     ],
 )
diff --git a/java/com/google/gerrit/server/cache/serialize/entities/BUILD b/java/com/google/gerrit/server/cache/serialize/entities/BUILD
index 55080e8..ead40c5 100644
--- a/java/com/google/gerrit/server/cache/serialize/entities/BUILD
+++ b/java/com/google/gerrit/server/cache/serialize/entities/BUILD
@@ -11,6 +11,7 @@
         "//lib:guava",
         "//lib:jgit",
         "//lib:protobuf",
+        "//lib/errorprone:annotations",
         "//proto:cache_java_proto",
     ],
 )
diff --git a/java/com/google/gerrit/server/cache/serialize/entities/package-info.java b/java/com/google/gerrit/server/cache/serialize/entities/package-info.java
new file mode 100644
index 0000000..0737d1b
--- /dev/null
+++ b/java/com/google/gerrit/server/cache/serialize/entities/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.cache.serialize.entities;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/cache/serialize/package-info.java b/java/com/google/gerrit/server/cache/serialize/package-info.java
new file mode 100644
index 0000000..05df981
--- /dev/null
+++ b/java/com/google/gerrit/server/cache/serialize/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.cache.serialize;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/cache/testing/BUILD b/java/com/google/gerrit/server/cache/testing/BUILD
index 09f698c..b823187 100644
--- a/java/com/google/gerrit/server/cache/testing/BUILD
+++ b/java/com/google/gerrit/server/cache/testing/BUILD
@@ -8,5 +8,6 @@
     visibility = ["//visibility:public"],
     deps = [
         "//lib:protobuf",
+        "//lib/errorprone:annotations",
     ],
 )
diff --git a/java/com/google/gerrit/server/cache/testing/package-info.java b/java/com/google/gerrit/server/cache/testing/package-info.java
new file mode 100644
index 0000000..ca05150
--- /dev/null
+++ b/java/com/google/gerrit/server/cache/testing/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.cache.testing;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/cancellation/BUILD b/java/com/google/gerrit/server/cancellation/BUILD
index 40557b1..c48456c 100644
--- a/java/com/google/gerrit/server/cancellation/BUILD
+++ b/java/com/google/gerrit/server/cancellation/BUILD
@@ -10,5 +10,6 @@
         "//java/com/google/gerrit/common:annotations",
         "//lib:guava",
         "//lib/commons:text",
+        "//lib/errorprone:annotations",
     ],
 )
diff --git a/java/com/google/gerrit/server/cancellation/RequestStateContext.java b/java/com/google/gerrit/server/cancellation/RequestStateContext.java
index 390c76f..39cd441 100644
--- a/java/com/google/gerrit/server/cancellation/RequestStateContext.java
+++ b/java/com/google/gerrit/server/cancellation/RequestStateContext.java
@@ -16,6 +16,7 @@
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.ImmutableSet;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -136,6 +137,7 @@
    * @param requestStateProvider the {@link RequestStateProvider} that should be registered
    * @return the {@code RequestStateContext} instance for chaining calls
    */
+  @CanIgnoreReturnValue
   public RequestStateContext addRequestStateProvider(RequestStateProvider requestStateProvider) {
     if (threadLocalRequestStateProviders.get() == null) {
       threadLocalRequestStateProviders.set(new HashSet<>());
diff --git a/java/com/google/gerrit/server/cancellation/package-info.java b/java/com/google/gerrit/server/cancellation/package-info.java
new file mode 100644
index 0000000..ac09229
--- /dev/null
+++ b/java/com/google/gerrit/server/cancellation/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.cancellation;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/change/ChangeJson.java b/java/com/google/gerrit/server/change/ChangeJson.java
index beff1a3..6d39d7a 100644
--- a/java/com/google/gerrit/server/change/ChangeJson.java
+++ b/java/com/google/gerrit/server/change/ChangeJson.java
@@ -53,6 +53,7 @@
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 import com.google.common.flogger.FluentLogger;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.common.Nullable;
 import com.google.gerrit.entities.Account;
 import com.google.gerrit.entities.Address;
@@ -296,6 +297,7 @@
     logger.atFine().log("options = %s", options);
   }
 
+  @CanIgnoreReturnValue
   public ChangeJson fix(FixInput fix) {
     this.fix = fix;
     return this;
diff --git a/java/com/google/gerrit/server/change/CommentThread.java b/java/com/google/gerrit/server/change/CommentThread.java
index 0265f60..51422b1 100644
--- a/java/com/google/gerrit/server/change/CommentThread.java
+++ b/java/com/google/gerrit/server/change/CommentThread.java
@@ -18,6 +18,7 @@
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Streams;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.entities.Comment;
 import com.google.gerrit.entities.HumanComment;
 import java.util.List;
@@ -58,6 +59,7 @@
 
     public abstract Builder<T> comments(List<T> value);
 
+    @CanIgnoreReturnValue
     public Builder<T> addComment(T comment) {
       commentsBuilder().add(comment);
       return this;
diff --git a/java/com/google/gerrit/server/change/ConsistencyChecker.java b/java/com/google/gerrit/server/change/ConsistencyChecker.java
index b216db3..9f7a7fc 100644
--- a/java/com/google/gerrit/server/change/ConsistencyChecker.java
+++ b/java/com/google/gerrit/server/change/ConsistencyChecker.java
@@ -29,6 +29,7 @@
 import com.google.common.collect.MultimapBuilder;
 import com.google.common.collect.SetMultimap;
 import com.google.common.flogger.FluentLogger;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.common.Nullable;
 import com.google.gerrit.entities.Change;
 import com.google.gerrit.entities.PatchSet;
@@ -778,6 +779,7 @@
     return null;
   }
 
+  @CanIgnoreReturnValue
   private ProblemInfo problem(String msg) {
     ProblemInfo p = new ProblemInfo();
     p.message = requireNonNull(msg);
diff --git a/java/com/google/gerrit/server/change/PatchSetInserter.java b/java/com/google/gerrit/server/change/PatchSetInserter.java
index 854fd4e..ac9d6b9 100644
--- a/java/com/google/gerrit/server/change/PatchSetInserter.java
+++ b/java/com/google/gerrit/server/change/PatchSetInserter.java
@@ -23,6 +23,7 @@
 
 import com.google.common.collect.ImmutableListMultimap;
 import com.google.common.collect.ImmutableSet;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.common.Nullable;
 import com.google.gerrit.entities.Change;
 import com.google.gerrit.entities.PatchSet;
@@ -161,37 +162,44 @@
     return psId;
   }
 
+  @CanIgnoreReturnValue
   public PatchSetInserter setMessage(String message) {
     this.message = message;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public PatchSetInserter setDescription(String description) {
     this.description = description;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public PatchSetInserter setWorkInProgress(boolean workInProgress) {
     this.workInProgress = workInProgress;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public PatchSetInserter setValidate(boolean validate) {
     this.validate = validate;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public PatchSetInserter setCheckAddPatchSetPermission(boolean checkAddPatchSetPermission) {
     this.checkAddPatchSetPermission = checkAddPatchSetPermission;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public PatchSetInserter setGroups(List<String> groups) {
     requireNonNull(groups, "groups may not be null");
     this.groups = groups;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public PatchSetInserter setValidationOptions(
       ImmutableListMultimap<String, String> validationOptions) {
     requireNonNull(validationOptions, "validationOptions may not be null");
@@ -199,21 +207,25 @@
     return this;
   }
 
+  @CanIgnoreReturnValue
   public PatchSetInserter setFireRevisionCreated(boolean fireRevisionCreated) {
     this.fireRevisionCreated = fireRevisionCreated;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public PatchSetInserter setAllowClosed(boolean allowClosed) {
     this.allowClosed = allowClosed;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public PatchSetInserter setSendEmail(boolean sendEmail) {
     this.sendEmail = sendEmail;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public PatchSetInserter setTopic(String topic) {
     this.topic = topic;
     return this;
@@ -225,6 +237,7 @@
    * cases, we already store the votes of the new patch-sets in SubmitStrategyOp#saveApprovals. We
    * should not also store the copied votes.
    */
+  @CanIgnoreReturnValue
   public PatchSetInserter setStoreCopiedVotes(boolean storeCopiedVotes) {
     this.storeCopiedVotes = storeCopiedVotes;
     return this;
diff --git a/java/com/google/gerrit/server/change/RebaseChangeOp.java b/java/com/google/gerrit/server/change/RebaseChangeOp.java
index 9699317..ca8ba7e 100644
--- a/java/com/google/gerrit/server/change/RebaseChangeOp.java
+++ b/java/com/google/gerrit/server/change/RebaseChangeOp.java
@@ -25,6 +25,7 @@
 import com.google.common.collect.ImmutableListMultimap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.flogger.FluentLogger;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.entities.Change;
 import com.google.gerrit.entities.PatchSet;
 import com.google.gerrit.entities.Project;
@@ -198,26 +199,31 @@
     this.originalPatchSet = originalPatchSet;
   }
 
+  @CanIgnoreReturnValue
   public RebaseChangeOp setCommitterIdent(PersonIdent committerIdent) {
     this.committerIdent = committerIdent;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public RebaseChangeOp setValidate(boolean validate) {
     this.validate = validate;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public RebaseChangeOp setCheckAddPatchSetPermission(boolean checkAddPatchSetPermission) {
     this.checkAddPatchSetPermission = checkAddPatchSetPermission;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public RebaseChangeOp setFireRevisionCreated(boolean fireRevisionCreated) {
     this.fireRevisionCreated = fireRevisionCreated;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public RebaseChangeOp setForceContentMerge(boolean forceContentMerge) {
     this.forceContentMerge = forceContentMerge;
     return this;
@@ -231,16 +237,19 @@
    *
    * @see #setForceContentMerge(boolean)
    */
+  @CanIgnoreReturnValue
   public RebaseChangeOp setAllowConflicts(boolean allowConflicts) {
     this.allowConflicts = allowConflicts;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public RebaseChangeOp setDetailedCommitMessage(boolean detailedCommitMessage) {
     this.detailedCommitMessage = detailedCommitMessage;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public RebaseChangeOp setPostMessage(boolean postMessage) {
     this.postMessage = postMessage;
     return this;
@@ -252,21 +261,25 @@
    * cases, we already store the votes of the new patch-sets in SubmitStrategyOp#saveApprovals. We
    * should not also store the copied votes.
    */
+  @CanIgnoreReturnValue
   public RebaseChangeOp setStoreCopiedVotes(boolean storeCopiedVotes) {
     this.storeCopiedVotes = storeCopiedVotes;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public RebaseChangeOp setSendEmail(boolean sendEmail) {
     this.sendEmail = sendEmail;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public RebaseChangeOp setMatchAuthorToCommitterDate(boolean matchAuthorToCommitterDate) {
     this.matchAuthorToCommitterDate = matchAuthorToCommitterDate;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public RebaseChangeOp setValidationOptions(
       ImmutableListMultimap<String, String> validationOptions) {
     requireNonNull(validationOptions, "validationOptions may not be null");
@@ -274,11 +287,13 @@
     return this;
   }
 
+  @CanIgnoreReturnValue
   public RebaseChangeOp setMergeStrategy(String strategy) {
     this.mergeStrategy = strategy;
     return this;
   }
 
+  @CanIgnoreReturnValue
   public RebaseChangeOp setVerifyNeedsRebase(boolean verifyNeedsRebase) {
     this.verifyNeedsRebase = verifyNeedsRebase;
     return this;
diff --git a/java/com/google/gerrit/server/change/ReviewerModifier.java b/java/com/google/gerrit/server/change/ReviewerModifier.java
index daa41bf..d714215 100644
--- a/java/com/google/gerrit/server/change/ReviewerModifier.java
+++ b/java/com/google/gerrit/server/change/ReviewerModifier.java
@@ -667,7 +667,9 @@
         throws RestApiException, IOException, PermissionBackendException {
       for (ReviewerModification addition : modifications()) {
         addition.op.setPatchSet(patchSet);
-        addition.op.updateChange(ctx);
+
+        @SuppressWarnings("unused")
+        var unused = addition.op.updateChange(ctx);
       }
     }
 
diff --git a/java/com/google/gerrit/server/change/WalkSorter.java b/java/com/google/gerrit/server/change/WalkSorter.java
index d2f7ede..6c903b8 100644
--- a/java/com/google/gerrit/server/change/WalkSorter.java
+++ b/java/com/google/gerrit/server/change/WalkSorter.java
@@ -24,6 +24,7 @@
 import com.google.common.collect.MultimapBuilder;
 import com.google.common.collect.Ordering;
 import com.google.common.flogger.FluentLogger;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.entities.PatchSet;
 import com.google.gerrit.entities.Project;
 import com.google.gerrit.exceptions.StorageException;
@@ -87,11 +88,13 @@
     includePatchSets = new HashSet<>();
   }
 
+  @CanIgnoreReturnValue
   public WalkSorter includePatchSets(Iterable<PatchSet.Id> patchSets) {
     Iterables.addAll(includePatchSets, patchSets);
     return this;
   }
 
+  @CanIgnoreReturnValue
   public WalkSorter setRetainBody(boolean retainBody) {
     this.retainBody = retainBody;
     return this;
diff --git a/java/com/google/gerrit/server/change/package-info.java b/java/com/google/gerrit/server/change/package-info.java
new file mode 100644
index 0000000..0f70412
--- /dev/null
+++ b/java/com/google/gerrit/server/change/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.change;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/change/testing/package-info.java b/java/com/google/gerrit/server/change/testing/package-info.java
new file mode 100644
index 0000000..3cd4da3
--- /dev/null
+++ b/java/com/google/gerrit/server/change/testing/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.change.testing;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/comment/package-info.java b/java/com/google/gerrit/server/comment/package-info.java
new file mode 100644
index 0000000..e06653b
--- /dev/null
+++ b/java/com/google/gerrit/server/comment/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.comment;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/config/ConfigUtil.java b/java/com/google/gerrit/server/config/ConfigUtil.java
index 22c3d99..44bfa48 100644
--- a/java/com/google/gerrit/server/config/ConfigUtil.java
+++ b/java/com/google/gerrit/server/config/ConfigUtil.java
@@ -17,6 +17,7 @@
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.flogger.FluentLogger;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.common.UsedAt;
 import com.google.gerrit.common.UsedAt.Project;
 import java.io.IOException;
@@ -344,6 +345,7 @@
    *     when their values are false
    * @return loaded instance
    */
+  @CanIgnoreReturnValue
   public static <T> T loadSection(Config cfg, String section, String sub, T s, T defaults, T i)
       throws ConfigInvalidException {
     try {
diff --git a/java/com/google/gerrit/server/config/package-info.java b/java/com/google/gerrit/server/config/package-info.java
new file mode 100644
index 0000000..349fb04
--- /dev/null
+++ b/java/com/google/gerrit/server/config/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.config;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/data/BUILD b/java/com/google/gerrit/server/data/BUILD
index 1aaab96..4eb7b7f 100644
--- a/java/com/google/gerrit/server/data/BUILD
+++ b/java/com/google/gerrit/server/data/BUILD
@@ -10,5 +10,6 @@
         "//java/com/google/gerrit/entities",
         "//java/com/google/gerrit/extensions:api",
         "//lib:gson",
+        "//lib/errorprone:annotations",
     ],
 )
diff --git a/java/com/google/gerrit/server/data/package-info.java b/java/com/google/gerrit/server/data/package-info.java
new file mode 100644
index 0000000..0383bb5
--- /dev/null
+++ b/java/com/google/gerrit/server/data/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.data;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/diff/package-info.java b/java/com/google/gerrit/server/diff/package-info.java
new file mode 100644
index 0000000..874dd17
--- /dev/null
+++ b/java/com/google/gerrit/server/diff/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.diff;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/documentation/package-info.java b/java/com/google/gerrit/server/documentation/package-info.java
new file mode 100644
index 0000000..64b3ea1
--- /dev/null
+++ b/java/com/google/gerrit/server/documentation/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.documentation;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/edit/ChangeEditModifier.java b/java/com/google/gerrit/server/edit/ChangeEditModifier.java
index 5602538..d9a118d 100644
--- a/java/com/google/gerrit/server/edit/ChangeEditModifier.java
+++ b/java/com/google/gerrit/server/edit/ChangeEditModifier.java
@@ -18,6 +18,7 @@
 import static com.google.gerrit.server.update.context.RefUpdateContext.RefUpdateType.CHANGE_MODIFICATION;
 
 import com.google.common.base.Charsets;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.common.Nullable;
 import com.google.gerrit.entities.BooleanProjectConfig;
 import com.google.gerrit.entities.Change;
@@ -394,6 +395,7 @@
         repository, notes, new ModificationIntention.PatchsetCommit(patchSet), commitModification);
   }
 
+  @CanIgnoreReturnValue
   private ChangeEdit modifyCommit(
       Repository repository,
       ChangeNotes notes,
@@ -851,6 +853,7 @@
       this.gitReferenceUpdated = gitReferenceUpdated;
     }
 
+    @CanIgnoreReturnValue
     ChangeEdit createEdit(
         Repository repository,
         ChangeNotes notes,
diff --git a/java/com/google/gerrit/server/edit/CommitModification.java b/java/com/google/gerrit/server/edit/CommitModification.java
index 648ef0f..f412e67 100644
--- a/java/com/google/gerrit/server/edit/CommitModification.java
+++ b/java/com/google/gerrit/server/edit/CommitModification.java
@@ -16,6 +16,7 @@
 
 import com.google.auto.value.AutoValue;
 import com.google.common.collect.ImmutableList;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.server.edit.tree.TreeModification;
 import java.util.Optional;
 import org.eclipse.jgit.lib.PersonIdent;
@@ -37,6 +38,7 @@
 
   @AutoValue.Builder
   public abstract static class Builder {
+    @CanIgnoreReturnValue
     public Builder addTreeModification(TreeModification treeModification) {
       treeModificationsBuilder().add(treeModification);
       return this;
diff --git a/java/com/google/gerrit/server/edit/package-info.java b/java/com/google/gerrit/server/edit/package-info.java
new file mode 100644
index 0000000..dea8a96
--- /dev/null
+++ b/java/com/google/gerrit/server/edit/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.edit;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/edit/tree/package-info.java b/java/com/google/gerrit/server/edit/tree/package-info.java
new file mode 100644
index 0000000..4070c14
--- /dev/null
+++ b/java/com/google/gerrit/server/edit/tree/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.edit.tree;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/events/package-info.java b/java/com/google/gerrit/server/events/package-info.java
new file mode 100644
index 0000000..cf589fe
--- /dev/null
+++ b/java/com/google/gerrit/server/events/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.events;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/experiments/package-info.java b/java/com/google/gerrit/server/experiments/package-info.java
new file mode 100644
index 0000000..eeaeac6
--- /dev/null
+++ b/java/com/google/gerrit/server/experiments/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.experiments;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/extensions/events/package-info.java b/java/com/google/gerrit/server/extensions/events/package-info.java
new file mode 100644
index 0000000..c2f060e
--- /dev/null
+++ b/java/com/google/gerrit/server/extensions/events/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.extensions.events;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/extensions/webui/package-info.java b/java/com/google/gerrit/server/extensions/webui/package-info.java
new file mode 100644
index 0000000..e5d7b48
--- /dev/null
+++ b/java/com/google/gerrit/server/extensions/webui/package-info.java
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+@CheckReturnValue
+package com.google.gerrit.server.extensions.webui;
+
+import com.google.errorprone.annotations.CheckReturnValue;
diff --git a/java/com/google/gerrit/server/submit/RebaseSubmitStrategy.java b/java/com/google/gerrit/server/submit/RebaseSubmitStrategy.java
index 492b7f6..780ebb5 100644
--- a/java/com/google/gerrit/server/submit/RebaseSubmitStrategy.java
+++ b/java/com/google/gerrit/server/submit/RebaseSubmitStrategy.java
@@ -233,7 +233,9 @@
 
       PatchSet newPs;
       if (rebaseOp != null) {
-        rebaseOp.updateChange(ctx);
+        @SuppressWarnings("unused")
+        var unused = rebaseOp.updateChange(ctx);
+
         newPs = rebaseOp.getPatchSet();
       } else {
         // CherryPick
diff --git a/javatests/com/google/gerrit/acceptance/rest/change/ActionsIT.java b/javatests/com/google/gerrit/acceptance/rest/change/ActionsIT.java
index 66dffa7..78d6737 100644
--- a/javatests/com/google/gerrit/acceptance/rest/change/ActionsIT.java
+++ b/javatests/com/google/gerrit/acceptance/rest/change/ActionsIT.java
@@ -345,7 +345,11 @@
 
       // ...via ChangeJson directly.
       ChangeData cd = changeDataFactory.create(project, changeId);
-      revisionJsonFactory.create(opts).getRevisionInfo(cd, cd.patchSet(PatchSet.id(changeId, 1)));
+      revisionInfo =
+          revisionJsonFactory
+              .create(opts)
+              .getRevisionInfo(cd, cd.patchSet(PatchSet.id(changeId, revisionInfo._number)));
+      visitedCurrentRevisionActionsAssertions(origActions, revisionInfo.actions);
     }
   }
 
diff --git a/javatests/com/google/gerrit/server/change/WalkSorterTest.java b/javatests/com/google/gerrit/server/change/WalkSorterTest.java
index 2c4c98f..7775452 100644
--- a/javatests/com/google/gerrit/server/change/WalkSorterTest.java
+++ b/javatests/com/google/gerrit/server/change/WalkSorterTest.java
@@ -19,6 +19,7 @@
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.gerrit.entities.Account;
 import com.google.gerrit.entities.Change;
 import com.google.gerrit.entities.PatchSet;
@@ -338,6 +339,7 @@
     return cd;
   }
 
+  @CanIgnoreReturnValue
   private PatchSet addPatchSet(ChangeData cd, ObjectId id) throws Exception {
     TestChanges.incrementPatchSet(cd.change());
     PatchSet ps = TestChanges.newPatchSet(cd.change().currentPatchSetId(), id.name(), userId);