From b6680422dbc0aebcd46a821f183dce101b5cd411 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Wed, 11 Jun 2025 17:42:21 +0200 Subject: [PATCH] Change signature of RetryOperations.execute() regarding nullability Due to lacking support in NullAway for the current arrangement, we are (perhaps temporarily) changing the signature of the execute() method in RetryOperations (and thus also in RetryTemplate)... from: R execute(Retryable retryable); to: @Nullable R execute(Retryable retryable); Once https://github.com/uber/NullAway/issues/1075 has been resolved, we will consider switching back to the original signature. See gh-34716 --- .../java/org/springframework/core/retry/RetryOperations.java | 2 +- .../main/java/org/springframework/core/retry/RetryTemplate.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 c72c6f05e84..45d99c7e5c1 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 @@ -41,6 +41,6 @@ public interface RetryOperations { * encountered during retry attempts should be made available as suppressed * exceptions */ - R execute(Retryable retryable) throws RetryException; + @Nullable 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 40cca6a2647..04e6da98123 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 @@ -142,7 +142,7 @@ public class RetryTemplate implements RetryOperations { * encountered during retry attempts are available as suppressed exceptions */ @Override - public R execute(Retryable retryable) throws RetryException { + public @Nullable R execute(Retryable retryable) throws RetryException { String retryableName = retryable.getName(); // Initial attempt try {