From fd3bbb057ec378c55135e557f6f82b49204db6c9 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sun, 25 Jan 2026 10:42:13 +0100 Subject: [PATCH] Polishing --- .../org/springframework/core/retry/RetryTemplate.java | 2 +- .../springframework/core/task/AsyncTaskExecutor.java | 11 +++-------- .../core/retry/RetryTemplateTests.java | 8 ++++---- .../orm/jpa/SharedEntityManagerCreator.java | 6 +++--- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java b/spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java index ab0b9a54bc3..165989a6262 100644 --- a/spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java +++ b/spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java @@ -89,7 +89,7 @@ public class RetryTemplate implements RetryOperations { * @see RetryPolicy#builder() */ public void setRetryPolicy(RetryPolicy retryPolicy) { - Assert.notNull(retryPolicy, "Retry policy must not be null"); + Assert.notNull(retryPolicy, "RetryPolicy must not be null"); this.retryPolicy = retryPolicy; } diff --git a/spring-core/src/main/java/org/springframework/core/task/AsyncTaskExecutor.java b/spring-core/src/main/java/org/springframework/core/task/AsyncTaskExecutor.java index 2ad95139c07..a2077863ef4 100644 --- a/spring-core/src/main/java/org/springframework/core/task/AsyncTaskExecutor.java +++ b/spring-core/src/main/java/org/springframework/core/task/AsyncTaskExecutor.java @@ -27,14 +27,10 @@ import org.springframework.util.concurrent.FutureUtils; /** * Extended interface for asynchronous {@link TaskExecutor} implementations, - * offering support for {@link java.util.concurrent.Callable}. - * - *

Note: The {@link java.util.concurrent.Executors} class includes a set of - * methods that can convert some other common closure-like objects, for example, - * {@link java.security.PrivilegedAction} to {@link Callable} before executing them. + * offering support for {@link Future}/{@link CompletableFuture} handles. * *

Implementing this interface also indicates that the {@link #execute(Runnable)} - * method will not execute its Runnable in the caller's thread but rather + * method will not execute the given Runnable in the caller's thread but rather * asynchronously in some other thread. * * @author Juergen Hoeller @@ -127,8 +123,7 @@ public interface AsyncTaskExecutor extends TaskExecutor { /** * Submit a {@code Callable} task for execution, receiving a {@code CompletableFuture} - * representing that task. The Future will return the Callable's result upon - * completion. + * representing that task. The Future will return the Callable's result upon completion. * @param task the {@code Callable} to execute (never {@code null}) * @return a {@code CompletableFuture} representing pending completion of the task * @throws TaskRejectedException if the given task was not accepted diff --git a/spring-core/src/test/java/org/springframework/core/retry/RetryTemplateTests.java b/spring-core/src/test/java/org/springframework/core/retry/RetryTemplateTests.java index 000d5f63105..189a8bac8bd 100644 --- a/spring-core/src/test/java/org/springframework/core/retry/RetryTemplateTests.java +++ b/spring-core/src/test/java/org/springframework/core/retry/RetryTemplateTests.java @@ -60,13 +60,13 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; */ class RetryTemplateTests { - private final RetryPolicy retryPolicy = RetryPolicy.builder().maxRetries(3).delay(Duration.ZERO).build(); + RetryPolicy retryPolicy = RetryPolicy.builder().maxRetries(3).delay(Duration.ZERO).build(); - private final RetryTemplate retryTemplate = new RetryTemplate(retryPolicy); + RetryTemplate retryTemplate = new RetryTemplate(retryPolicy); - private final RetryListener retryListener = mock(); + RetryListener retryListener = mock(); - private final InOrder inOrder = inOrder(retryListener); + InOrder inOrder = inOrder(retryListener); @BeforeEach diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/SharedEntityManagerCreator.java b/spring-orm/src/main/java/org/springframework/orm/jpa/SharedEntityManagerCreator.java index e4d6030329f..303a2409513 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/SharedEntityManagerCreator.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/SharedEntityManagerCreator.java @@ -215,7 +215,7 @@ public abstract class SharedEntityManagerCreator { } @Override - public @Nullable Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + public @Nullable Object invoke(Object proxy, Method method, @Nullable Object[] args) throws Throwable { // Invocation on EntityManager interface coming in... switch (method.getName()) { @@ -361,7 +361,7 @@ public abstract class SharedEntityManagerCreator { private @Nullable EntityManager entityManager; - private @Nullable Map outputParameters; + private @Nullable Map<@Nullable Object, @Nullable Object> outputParameters; public DeferredQueryInvocationHandler(Query target, EntityManager entityManager) { this.target = target; @@ -369,7 +369,7 @@ public abstract class SharedEntityManagerCreator { } @Override - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + public @Nullable Object invoke(Object proxy, Method method, @Nullable Object[] args) throws Throwable { // Invocation on Query interface coming in... switch (method.getName()) {