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
This commit is contained in:
Sam Brannen
2025-06-11 17:42:21 +02:00
parent a462f5e853
commit b6680422db
2 changed files with 2 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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 {