Skip to content

Commit 9982369

Browse files
committed
Revise nullability in RetryException
See gh-35332
1 parent 532911e commit 9982369

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

spring-core/src/main/java/org/springframework/core/retry/RetryException.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
import java.io.Serial;
2020
import java.util.Objects;
2121

22-
import org.jspecify.annotations.NonNull;
23-
2422
/**
2523
* Exception thrown when a {@link RetryPolicy} has been exhausted.
2624
*
@@ -37,15 +35,18 @@ public class RetryException extends Exception {
3735
/**
3836
* Create a new {@code RetryException} for the supplied message and cause.
3937
* @param message the detail message
40-
* @param cause the root cause
38+
* @param cause the last exception thrown by the {@link Retryable} operation
4139
*/
4240
public RetryException(String message, Throwable cause) {
43-
super(message, cause);
41+
super(message, Objects.requireNonNull(cause, "cause must not be null"));
4442
}
4543

4644

45+
/**
46+
* Get the the last exception thrown by the {@link Retryable} operation.
47+
*/
4748
@Override
48-
public synchronized @NonNull Throwable getCause() {
49+
public final synchronized Throwable getCause() {
4950
return Objects.requireNonNull(super.getCause());
5051
}
5152

0 commit comments

Comments
 (0)