Commit Graph

4397 Commits

Author SHA1 Message Date
Tran Ngoc Nhan 1a046f9cec Fix Nullable import in ClassFileAnnotationMetadata
Closes gh-35114

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-06-25 20:43:09 +02:00
Brian Clozel 2fa25b50d9 Fix caching operations in CachingMetadataReaderFactory
gh-33616 refactored `CachingMetadataReaderFactory` and broke the
behavior as it bypassed the cache for `getMetadataReader(String
className)` operations.

This commit restores the original behavior.

Fixes gh-35112
2025-06-25 20:32:38 +02:00
Sam Brannen f3f05da39b Refer to Spring Retry project in Javadoc
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-25 16:38:48 +02:00
Juergen Hoeller e828bbbb0a Invert order of suppressed exceptions (for common exception rendering)
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
See gh-35057
2025-06-24 22:22:45 +02:00
Sébastien Deleuze 839d3a7d44 Refine nullability of PropertyResolver.getProperty(key: String)
Closes gh-35104
2025-06-24 16:06:32 +02:00
Sébastien Deleuze 294406dae9 Remove `@Suppress("EXTENSION_SHADOWED_BY_MEMBER")`
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Fixed in Kotlin 2.2.0 and IntelliJ IDEA IDEA 2024.2 EAP, see
https://youtrack.jetbrains.com/issue/KT-75169 related issue.

See gh-34453
2025-06-24 11:40:23 +02:00
Juergen Hoeller 6927e39e6b Merge branch '6.2.x' 2025-06-18 12:23:07 +02:00
Juergen Hoeller aa525cc3cd Delegate to ReflectionUtils.accessibleConstructor
Backport Bot / build (push) Has been cancelled Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details
2025-06-18 12:20:30 +02:00
Sam Brannen c5fd57d92b Polish @⁠Retryable Javadoc and internals 2025-06-17 17:07:15 +02:00
Sébastien Deleuze f601bbb2ac Allow usage of `@CheckReturnValue` on types and ctors
Closes gh-34910
2025-06-17 16:53:12 +02:00
Sam Brannen 74ee1b991a Apply consistent copyright headers in Kotlin source code
See gh-35070
2025-06-17 16:24:15 +02:00
Spring Builds 16edf9867a Update copyright headers in source files
This commit updates Java, Kotlin, and Groovy source files to use the
"<year>-present" pattern in copyright headers.

Closes gh-35070
2025-06-17 16:23:50 +02:00
Sam Brannen 103a7e58bb Apply consistent copyright headers in Kotlin source code
See gh-35070
2025-06-17 15:54:58 +02:00
Spring Builds aee29b7f30 Update copyright headers in source files
This commit updates Java, Kotlin, and Groovy source files to use the
"<year>-present" pattern in copyright headers.

Closes gh-35070
2025-06-17 15:54:58 +02:00
Juergen Hoeller f69df9b767 Introduce retry interceptor and annotation-based retry support
Based on RetryTemplate with ExponentialBackOff.
Includes optional jitter support in ExponentialBackOff.
Supports reactive methods through Reactor's RetryBackoffSpec.

Closes gh-34529
2025-06-17 12:49:29 +02:00
Sam Brannen cc7dc47c4c Simplify suppressed exception assertions
See https://github.com/assertj/assertj/issues/3858
2025-06-16 16:32:24 +02:00
Sam Brannen 6bbfd56dce Remove duplication in RetryTemplateTests 2025-06-16 14:32:33 +02:00
Sam Brannen f41a568b1d Improve Javadoc for RetryPolicy.Builder 2025-06-16 14:31:50 +02:00
Sam Brannen 09372b72ae Add retryWithExceptionExcludes() test 2025-06-16 13:33:10 +02:00
Sam Brannen 97522cfa36 Introduce Builder API and factory methods for RetryPolicy
Prior to this commit, we had three concrete RetryPolicy implementations.

- MaxRetryAttemptsPolicy
- MaxDurationAttemptsPolicy
- PredicateRetryPolicy

However, there was no way to combine the behavior of those policies.
Furthermore, the PredicateRetryPolicy was practically useless as a
standalone policy, since it did not have a way to end an infinite loop
for a Retryable that continually throws an exception which matches the
predicate.

This commit therefore replaces the current built-in RetryPolicy
implementations with a fluent Builder API and dedicated factory methods
for common use cases.

In addition, this commit also introduces built-in support for
specifying include/exclude lists.

Examples:

new MaxRetryAttemptsPolicy(5) -->

    RetryPolicy.withMaxAttempts(5)

new MaxDurationAttemptsPolicy(Duration.ofSeconds(5)) -->

    RetryPolicy.withMaxDuration(Duration.ofSeconds(5))

new PredicateRetryPolicy(IOException.class::isInstance) -->

    RetryPolicy.builder()
        .maxAttempts(3)
        .predicate(IOException.class::isInstance)
        .build();

The following example demonstrates all supported features of the builder.

RetryPolicy.builder()
    .maxAttempts(5)
    .maxDuration(Duration.ofMillis(100))
    .includes(IOException.class)
    .excludes(FileNotFoundException.class)
    .predicate(t -> t.getMessage().contains("Unexpected failure"))
    .build();

Closes gh-35058
2025-06-16 13:15:38 +02:00
Juergen Hoeller 945f3fb5ac Revise RetryTemplate for alignment with Reactor
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Exposes last exception as cause in RetryException.
Applies first back-off after the initial exception.
Breaks out of retry loop on BackOffExecution.STOP.
Expects null result in Retryable and RetryListener.

Closes gh-35057
2025-06-16 12:05:25 +02:00
Brian Clozel af7758cbc7 Configure CheckStyle rule for empty catch blocks
This commit configures a new CheckStyle rule that fails for empty
"catch" blocks, unless the exception is named "ignored" or "expected".

This also fixes the remaining instances missed by the previous commit.

Closes gh-35047
2025-06-15 16:11:48 +02:00
Vincent Potucek 0d4dfb6c1f Rename exception variables in empty catch blocks
The Spring codebase sometimes ignores exceptions in catch blocks on
purpose. This is often called out by an inline comment.
We should make this more obvious by renaming the exception argument in
the catch block to declare whether the exception is "ignored" or
"expected".

See gh-35047

Signed-off-by: Vincent Potucek <vpotucek@me.com>
[brian.clozel@broadcom.com: rework commit message]
Signed-off-by: Brian Clozel <brian.clozel@broadcom.com>
2025-06-15 16:11:42 +02:00
Sam Brannen cd3ac44fb0 Add test for CompositeRetryListener.addListener() 2025-06-15 15:23:43 +02:00
Sam Brannen 8dc9621ad7 Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-14 15:35:09 +02:00
Sam Brannen 9f1aef16f9 Fix Javadoc for FixedBackOff
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-14 15:33:04 +02:00
Brian Clozel cd80ca0fe0 Merge branch '6.2.x' 2025-06-13 09:57:18 +02:00
Johnny Lim 722333f0f1 Polish DataBufferInputStream.skip()
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
See gh-34799
Closes gh-35030

Signed-off-by: Johnny Lim <izeye@naver.com>
2025-06-13 09:57:02 +02:00
Sam Brannen 082eb607ec Overhaul tests for RetryTemplate
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-12 17:34:54 +02:00
Sam Brannen ff167aafa2 Make built-in RetryPolicy implementations final
Closes gh-35040
2025-06-12 17:34:54 +02:00
Sam Brannen bfd3dc2676 Implement toString() in RetryPolicy and RetryExecution implementations
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Closes gh-35029
2025-06-11 19:17:03 +02:00
Sam Brannen bc967842f6 Rename and polish ComposedRetryListenerTests 2025-06-11 19:04:48 +02:00
Sam Brannen b6680422db Change signature of RetryOperations.execute() regarding nullability
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
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
2025-06-11 17:43:29 +02:00
Sam Brannen 8f3ca49bc4 Rename Retryable.run() to Retryable.execute()
See gh-34716
2025-06-11 13:50:16 +02:00
Sam Brannen d74b863ae7 Polish Javadoc for core retry functionality
See gh-34716
2025-06-11 13:49:00 +02:00
Sam Brannen 8b9e620084 Allow FixedBackOff to be constructed with only a custom interval
This commit introduces two new constructors:

- FixedBackOff(long)

- FixedBackOff(Duration)

Closes gh-35028
2025-06-11 13:26:16 +02:00
Sam Brannen fcdd439ad0 Polish Javadoc for FixedBackOff 2025-06-11 13:06:55 +02:00
Sébastien Deleuze b901132192 Merge branch '6.2.x' 2025-06-11 10:15:36 +02:00
Sébastien Deleuze 05c3f56ec7 Rely on default retention in `@Contract`
Closes gh-35027
2025-06-11 10:14:59 +02:00
Sam Brannen d42d3f1a6c Fix wording in Javadoc for RetryTemplate
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
See gh-34716
2025-06-10 18:34:56 +02:00
Sam Brannen 51b6e8cc9f Rename RetryCallback to Retryable
See gh-34716
2025-06-10 18:26:52 +02:00
Sam Brannen f927ff635a Revise @⁠Nullable declarations for contains*() in CollectionUtils
Closes gh-35023
2025-06-10 17:50:37 +02:00
Sébastien Deleuze be02d961fc Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-09 16:55:33 +02:00
Sébastien Deleuze 7bb19fcde8 Refine Kotlin Serialization hint registration
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
This commit adds support for serializer methods with a parameter.

Closes gh-34979
2025-06-09 16:48:15 +02:00
Sam Brannen 077146d636 Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-09 14:12:45 +02:00
Sam Brannen 18d6a55e3e Polishing and removal of "this." for method invocations
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-09 14:10:30 +02:00
Sam Brannen 315bbf3abe Consistently declare nullability @⁠Contract for core utilities
Closes gh-34934
2025-06-07 11:41:38 +02:00
Sam Brannen 7a6f9bd3c3 Use @⁠TempDir in FileSystemUtilsTests 2025-06-06 16:34:56 +02:00
Sam Brannen 3aa3b81e1c Update copyright headers
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-06 13:49:23 +02:00
Johnny Lim 7f6a7b806e Replace AssertionsForClassTypes with Assertions
Closes gh-34821

Signed-off-by: Johnny Lim <izeye@naver.com>
2025-06-06 13:49:23 +02:00