From 9e4a54bb99718e0d9e1500f9595a4a5c3512830c Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sun, 25 Jan 2026 17:46:14 +0100 Subject: [PATCH] Ensure RetryTaskTests compiles in Eclipse IDE Prior to this commit, "new RetryTask<>" declarations whose TaskCallbacks (implemented as lambda expressions) did not actually throw an exception resulted in a compilation error in Eclipse: "Unhandled exception type Exception". This is due to the fact that RetryTask is declared with "E extends Exception", and the Eclipse compiler therefore infers that the lambda expression potentially throws a checked Exception. To address that, this commit explicitly declares that the affected lambda expressions throw unchecked RuntimeExceptions: "new RetryTask" --- .../springframework/core/retry/support/RetryTaskTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-core/src/test/java/org/springframework/core/retry/support/RetryTaskTests.java b/spring-core/src/test/java/org/springframework/core/retry/support/RetryTaskTests.java index 2cb5e773356..3eb28cd9bad 100644 --- a/spring-core/src/test/java/org/springframework/core/retry/support/RetryTaskTests.java +++ b/spring-core/src/test/java/org/springframework/core/retry/support/RetryTaskTests.java @@ -52,7 +52,7 @@ class RetryTaskTests { @Test void syncTaskWithImmediateSuccess() { assertThat( - syncExecutor.execute(new RetryTask<>(() -> { + syncExecutor.execute(new RetryTask(() -> { invocationCount.incrementAndGet(); return "always succeeds"; }, retryPolicy))) @@ -63,7 +63,7 @@ class RetryTaskTests { @Test void syncTaskWithSuccessAfterInitialFailures() { assertThat( - syncExecutor.execute(new RetryTask<>(() -> { + syncExecutor.execute(new RetryTask(() -> { if (invocationCount.incrementAndGet() < 2) { throw new IllegalStateException("Boom " + invocationCount.get()); }