From 34be8e266de3f933f7d5b224012c429e7c824c73 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Thu, 25 Sep 2025 11:34:50 +0200 Subject: [PATCH] Revise nullability for Core Retry after upgrade to NullAway 0.12.10 This commit revises the nullability declarations in Retryable, RetryOperations, and RetryTemplate after the upgrade to NullAway 0.12.10. See gh-35492 --- .../resilience/retry/AbstractRetryInterceptor.java | 2 +- .../java/org/springframework/core/retry/RetryOperations.java | 2 +- .../java/org/springframework/core/retry/RetryTemplate.java | 2 +- .../main/java/org/springframework/core/retry/Retryable.java | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) 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