Skip to content

Commit 945d2a9

Browse files
committed
Fix unused vars and control flow warnings in ConcurrentExecutorTest
1 parent 678e5be commit 945d2a9

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/utils/ConcurrentExecutorTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ void destroyInterruptsAnyInterruptableRunningTasks() throws Exception {
181181
var task1 = new FutureTask<>(() -> sleepWait(10_000));
182182
var task2 = new FutureTask<>(() -> sleepWait(10_000));
183183

184-
executor.executorService.submit(task1);
185-
executor.executorService.submit(task2);
184+
var unused = executor.executorService.submit(task1);
185+
unused = executor.executorService.submit(task2);
186186

187187
// Give tasks the chance to start.
188188
Thread.sleep(1_000);
@@ -209,8 +209,8 @@ void destroyAbandonsAnyUninterruptableRunningTasks() throws Exception {
209209
var task1 = new FutureTask<>(() -> spinWait(10_000));
210210
var task2 = new FutureTask<>(() -> spinWait(10_000));
211211

212-
executor.executorService.submit(task1);
213-
executor.executorService.submit(task2);
212+
var unused = executor.executorService.submit(task1);
213+
unused = executor.executorService.submit(task2);
214214

215215
// Give tasks the chance to start.
216216
Thread.sleep(1_000);
@@ -423,7 +423,7 @@ void awaitingAwaitsAllTasksAndHandlesInterruptions() {
423423

424424
// Spin-based waits should not perform IO, so should be un-cancellable and
425425
// uninterruptible, representing CPU bound work or a buggy/stubborn task.
426-
@SuppressWarnings("SameParameterValue")
426+
@SuppressWarnings({"SameParameterValue", "RedundantControlFlow"})
427427
private static @Nullable Void spinWait(int timeoutMs) {
428428
var deadline = System.nanoTime() + timeoutMs * 1_000_000L;
429429
// Do not perform anything that can be interrupted.

0 commit comments

Comments
 (0)