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
This commit is contained in:
Sam Brannen 2025-09-25 11:34:50 +02:00
parent 5df082132d
commit 34be8e266d
4 changed files with 5 additions and 5 deletions

View File

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

View File

@ -46,6 +46,6 @@ public interface RetryOperations {
* @return the result of the {@code Retryable}, if any
* @throws RetryException if the {@code RetryPolicy} is exhausted
*/
<R> @Nullable R execute(Retryable<? extends @Nullable R> retryable) throws RetryException;
<R extends @Nullable Object> R execute(Retryable<R> retryable) throws RetryException;
}

View File

@ -134,7 +134,7 @@ public class RetryTemplate implements RetryOperations {
* @throws RetryException if the {@code RetryPolicy} is exhausted
*/
@Override
public <R> @Nullable R execute(Retryable<? extends @Nullable R> retryable) throws RetryException {
public <R extends @Nullable Object> R execute(Retryable<R> retryable) throws RetryException {
String retryableName = retryable.getName();
// Initial attempt
try {

View File

@ -31,14 +31,14 @@ import org.jspecify.annotations.Nullable;
* @see RetryOperations
*/
@FunctionalInterface
public interface Retryable<R> {
public interface Retryable<R extends @Nullable Object> {
/**
* 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