TaskListenerIT: Fix CheckReturnValue error
Release-Notes: skip
Change-Id: Icae8f171c9fe9ca0f2297bc042b26c47f9b692d5
diff --git a/javatests/com/google/gerrit/acceptance/server/util/TaskListenerIT.java b/javatests/com/google/gerrit/acceptance/server/util/TaskListenerIT.java
index b3094ac..c2de4f7 100644
--- a/javatests/com/google/gerrit/acceptance/server/util/TaskListenerIT.java
+++ b/javatests/com/google/gerrit/acceptance/server/util/TaskListenerIT.java
@@ -16,6 +16,7 @@
import static com.google.common.truth.Truth.assertThat;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.extensions.annotations.Exports;
import com.google.gerrit.server.git.WorkQueue;
@@ -51,8 +52,8 @@
public Latch latch = new Latch();
- private CountDownLatch called = new CountDownLatch(1);
- private CountDownLatch complete = new CountDownLatch(1);
+ private final CountDownLatch called = new CountDownLatch(1);
+ private final CountDownLatch complete = new CountDownLatch(1);
/** Assert that the Latch's call() method has not yet been called */
public void assertUncalled() {
@@ -72,6 +73,7 @@
complete.countDown();
}
+ @CanIgnoreReturnValue
private static boolean await(CountDownLatch latch) {
try {
return latch.await(AWAIT_TIMEOUT, AWAIT_TIMEUNIT);
@@ -139,8 +141,8 @@
@Inject private WorkQueue workQueue;
private ScheduledExecutorService executor;
- private LatchedListener listener = new LatchedListener();
- private LatchedRunnable runnable = new LatchedRunnable();
+ private final LatchedListener listener = new LatchedListener();
+ private final LatchedRunnable runnable = new LatchedRunnable();
@Override
public Module createModule() {
@@ -162,7 +164,8 @@
// "Log File Compressor"s are likely running and will interfere with tests
while (0 != workQueue.getTasks().size()) {
for (Task<?> t : workQueue.getTasks()) {
- t.cancel(true);
+ @SuppressWarnings("unused")
+ boolean unused = t.cancel(true);
}
TimeUnit.MILLISECONDS.sleep(1);
}