mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-07 15:39:29 +00:00
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<String, RuntimeException>"
This commit is contained in:
+2
-2
@@ -52,7 +52,7 @@ class RetryTaskTests {
|
||||
@Test
|
||||
void syncTaskWithImmediateSuccess() {
|
||||
assertThat(
|
||||
syncExecutor.execute(new RetryTask<>(() -> {
|
||||
syncExecutor.execute(new RetryTask<String, RuntimeException>(() -> {
|
||||
invocationCount.incrementAndGet();
|
||||
return "always succeeds";
|
||||
}, retryPolicy)))
|
||||
@@ -63,7 +63,7 @@ class RetryTaskTests {
|
||||
@Test
|
||||
void syncTaskWithSuccessAfterInitialFailures() {
|
||||
assertThat(
|
||||
syncExecutor.execute(new RetryTask<>(() -> {
|
||||
syncExecutor.execute(new RetryTask<String, RuntimeException>(() -> {
|
||||
if (invocationCount.incrementAndGet() < 2) {
|
||||
throw new IllegalStateException("Boom " + invocationCount.get());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user