Skip to content

Commit fcfe975

Browse files
committed
Add @nullable in RetryContext to easier detect possible NPE
Both getParent() and getLastThrowable() might return null, as mentioned in javadoc. @nullable helps an IDE warns developers about potential NPE.
1 parent a9b329a commit fcfe975

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/org/springframework/retry/RetryContext.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.retry;
1818

1919
import org.springframework.core.AttributeAccessor;
20+
import org.springframework.lang.Nullable;
2021

2122
/**
2223
* Low-level access to ongoing retry operation. Normally not needed by clients, but can be
@@ -85,6 +86,7 @@ public interface RetryContext extends AttributeAccessor {
8586
* Accessor for the parent context if retry blocks are nested.
8687
* @return the parent or null if there is none.
8788
*/
89+
@Nullable
8890
RetryContext getParent();
8991

9092
/**
@@ -100,6 +102,7 @@ public interface RetryContext extends AttributeAccessor {
100102
* if this is the first attempt, but also if the enclosing policy decides not to
101103
* provide it (e.g. because of concerns about memory usage).
102104
*/
105+
@Nullable
103106
Throwable getLastThrowable();
104107

105108
}

0 commit comments

Comments
 (0)