From e405d89082c667ab51389d1473d46e35c91b17e2 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 12 Sep 2024 13:12:30 -0700 Subject: [PATCH] Make errorprone's FutureReturnValueIgnored analyzer happy. (#185) Signed-off-by: Benjamin Peterson --- .bazelrc | 1 + .../analyzer/core/DatumSupplierTest.java | 23 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.bazelrc b/.bazelrc index e01b670..a06fb6e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -24,6 +24,7 @@ build --java_language_version=17 build --java_runtime_version=remotejdk_17 build --tool_java_language_version=17 build --tool_java_runtime_version=remotejdk_17 +build --javacopt=-Xep:FutureReturnValueIgnored:ERROR test --test_summary=testcase test --test_output=errors diff --git a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/core/DatumSupplierTest.java b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/core/DatumSupplierTest.java index 110169f..7f92dcd 100644 --- a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/core/DatumSupplierTest.java +++ b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/core/DatumSupplierTest.java @@ -51,17 +51,18 @@ public void memoizationIsThreadSafe() throws Exception { CountDownLatch startLatch = new CountDownLatch(1); CountDownLatch endLatch = new CountDownLatch(100); for (int i = 0; i < 100; ++i) { - executorService.submit( - () -> { - try { - startLatch.await(); - supplier.supply(); - retrievalCount.getAndIncrement(); - endLatch.countDown(); - } catch (Throwable e) { - throw new IllegalStateException(e); - } - }); + var unused = + executorService.submit( + () -> { + try { + startLatch.await(); + supplier.supply(); + retrievalCount.getAndIncrement(); + endLatch.countDown(); + } catch (Throwable e) { + throw new IllegalStateException(e); + } + }); } startLatch.countDown(); endLatch.await();