Browse Source

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 extends @Nullable Object> R execute(Retryable<R> retryable);

to:   <R> @Nullable R execute(Retryable<? extends @Nullable R> retryable);

Once https://github.com/uber/NullAway/issues/1075 has been resolved, we
will consider switching back to the original signature.

See gh-34716
pull/35037/head
Sam Brannen 10 months ago
parent
commit
b6680422db
  1. 2
      spring-core/src/main/java/org/springframework/core/retry/RetryOperations.java
  2. 2
      spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java

2
spring-core/src/main/java/org/springframework/core/retry/RetryOperations.java

@ -41,6 +41,6 @@ public interface RetryOperations { @@ -41,6 +41,6 @@ public interface RetryOperations {
* encountered during retry attempts should be made available as suppressed
* exceptions
*/
<R extends @Nullable Object> R execute(Retryable<R> retryable) throws RetryException;
<R> @Nullable R execute(Retryable<? extends @Nullable R> retryable) throws RetryException;
}

2
spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java

@ -142,7 +142,7 @@ public class RetryTemplate implements RetryOperations { @@ -142,7 +142,7 @@ public class RetryTemplate implements RetryOperations {
* encountered during retry attempts are available as suppressed exceptions
*/
@Override
public <R extends @Nullable Object> R execute(Retryable<R> retryable) throws RetryException {
public <R> @Nullable R execute(Retryable<? extends @Nullable R> retryable) throws RetryException {
String retryableName = retryable.getName();
// Initial attempt
try {

Loading…
Cancel
Save