PostTask: Suppress FutureReturnValueIgnored warning
When all error prone warnings are enabled the FutureReturnValueIgnored
bug pattern is reported:
plugins/webhooks/src/main/java/com/googlesource/gerrit/plugins/webhooks/PostTask.java:65:
error: [FutureReturnValueIgnored] Return value of methods returning Future must be checked.
Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.
executor.schedule(this, remote.getRetryInterval(), TimeUnit.MILLISECONDS);
^
(see https://errorprone.info/bugpattern/FutureReturnValueIgnored)
Did you mean to remove this line?
Change-Id: I4a23be8ad83d6362b6b30b4ed8f0041e19b830a2
diff --git a/src/main/java/com/googlesource/gerrit/plugins/webhooks/PostTask.java b/src/main/java/com/googlesource/gerrit/plugins/webhooks/PostTask.java
index 90c03b9..354bdf8 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/webhooks/PostTask.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/webhooks/PostTask.java
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.util.Optional;
import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLException;
@@ -62,7 +63,9 @@
}
private void reschedule() {
- executor.schedule(this, remote.getRetryInterval(), TimeUnit.MILLISECONDS);
+ @SuppressWarnings("unused")
+ ScheduledFuture<?> ignored =
+ executor.schedule(this, remote.getRetryInterval(), TimeUnit.MILLISECONDS);
}
@Override