diff --git a/spring-context/src/main/java/org/springframework/resilience/retry/AbstractRetryInterceptor.java b/spring-context/src/main/java/org/springframework/resilience/retry/AbstractRetryInterceptor.java index ff074f929e2..b85a181fc99 100644 --- a/spring-context/src/main/java/org/springframework/resilience/retry/AbstractRetryInterceptor.java +++ b/spring-context/src/main/java/org/springframework/resilience/retry/AbstractRetryInterceptor.java @@ -101,7 +101,7 @@ public abstract class AbstractRetryInterceptor implements MethodInterceptor { RetryTemplate retryTemplate = new RetryTemplate(retryPolicy); try { - return retryTemplate.execute(new Retryable<>() { + return retryTemplate.execute(new Retryable<@Nullable Object>() { @Override public @Nullable Object execute() throws Throwable { return (invocation instanceof ProxyMethodInvocation pmi ? diff --git a/spring-core/src/main/java/org/springframework/core/retry/RetryOperations.java b/spring-core/src/main/java/org/springframework/core/retry/RetryOperations.java index d125cb5f620..c4f0e250177 100644 --- a/spring-core/src/main/java/org/springframework/core/retry/RetryOperations.java +++ b/spring-core/src/main/java/org/springframework/core/retry/RetryOperations.java @@ -46,6 +46,6 @@ public interface RetryOperations { * @return the result of the {@code Retryable}, if any * @throws RetryException if the {@code RetryPolicy} is exhausted */ - @Nullable R execute(Retryable retryable) throws RetryException; + R execute(Retryable retryable) throws RetryException; } 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 b04cb8da180..437e8456e07 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 @@ -134,7 +134,7 @@ public class RetryTemplate implements RetryOperations { * @throws RetryException if the {@code RetryPolicy} is exhausted */ @Override - public @Nullable R execute(Retryable retryable) throws RetryException { + public R execute(Retryable retryable) throws RetryException { String retryableName = retryable.getName(); // Initial attempt try { diff --git a/spring-core/src/main/java/org/springframework/core/retry/Retryable.java b/spring-core/src/main/java/org/springframework/core/retry/Retryable.java index ed26c214024..b2e506f0365 100644 --- a/spring-core/src/main/java/org/springframework/core/retry/Retryable.java +++ b/spring-core/src/main/java/org/springframework/core/retry/Retryable.java @@ -31,14 +31,14 @@ import org.jspecify.annotations.Nullable; * @see RetryOperations */ @FunctionalInterface -public interface Retryable { +public interface Retryable { /** * Method to execute and retry if needed. * @return the result of the operation * @throws Throwable if an error occurs during the execution of the operation */ - @Nullable R execute() throws Throwable; + R execute() throws Throwable; /** * A unique, logical name for this retryable operation, used to distinguish