Repository navigation
Copy includes and excludes in RetryPolicy.Builder - #37596
Merged
sbrannen merged 1 commit intoOct 28, 2026
Merged
Conversation
Prior to this commit, RetryPolicy.Builder#build() passed its own includes and excludes sets to DefaultRetryPolicy, which only wraps them in read-only views. Adding includes or excludes to the builder after build() therefore changed which exceptions an already built policy retries. The back-off settings are not affected, since build() creates a new BackOff from them. This commit copies the includes and excludes in build(). Signed-off-by: Tanishq Choudhary <tanishqchoudhary007@gmail.com>
RetryPolicy.Builder
sbrannen
added a commit
that referenced
this pull request
Oct 28, 2026
This was referenced Oct 29, 2026
sbrannen
pushed a commit
that referenced
this pull request
Nov 21, 2026
Prior to this commit, HandlerTypePredicate.Builder#build() passed its own base packages, assignable types and annotations to the predicate, which only wrapped them in read-only views. Changing the builder after build() therefore also changed which handler types an already built predicate matched. This commit makes defensive copies in the HandlerTypePredicate constructor, as DefaultRetryPolicy does since gh-37596. Closes gh-37599 Signed-off-by: Tanishq Choudhary <tanishqchoudhary007@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RetryPolicy.Builder#build()passes its ownincludesandexcludessets to theDefaultRetryPolicy, andInstanceFilteronly wraps them in read-only views. So adding includes or excludes to the builder afterbuild()changes what an already built policy retries:The other settings don't have this problem, since
build()turns them into a newBackOff. It is the same kind of issue that #37325 fixed forWebTestClient#build().The fix copies the two sets in
build(). The new test inRetryPolicyTestsfails without it:I ran
./gradlew :spring-core:checkon Windows with JDK 25. The only failures were inResourceRegionEncoderTests,PathMatchingResourcePatternResolverTestsandDataBufferUtilsTests(which also hangs here), and they fail the same way onmainon this machine.