Commit Graph

4507 Commits

Author SHA1 Message Date
Juergen Hoeller 37319fc367 Merge branch '6.2.x'
# Conflicts:
#	spring-core/src/main/java/org/springframework/cglib/core/CodeEmitter.java
2025-10-02 21:56:12 +02:00
Juergen Hoeller 3041071269 Consistently apply useCaches for single Resource lookup
Closes gh-35465
2025-10-02 21:53:47 +02:00
Juergen Hoeller 2da821389c Remove redundant object allocation in cglib proxy method calls
Reformatted with Spring patch markers and backported to 6.2.12

Closes gh-35543
2025-10-02 21:53:34 +02:00
Nurlan Turdaliev b4d501f888 Remove redundant object allocation in cglib proxy method calls
* Fixes gh-35542

Signed-off-by: Nurlan Turdaliev <nurlan0000@gmail.com>
2025-10-02 21:22:19 +02:00
Sam Brannen 1e83de072c Merge branch '6.2.x' 2025-10-02 11:45:43 +02:00
Sam Brannen 717358b56b Short circuit ClassUtils.findPubliclyAccessibleMethodIfPossible(...)
Once we find a publicly accessible method, there is no need to continue
traversing the type hierarchy.

See gh-35556
2025-10-02 11:44:54 +02:00
Juergen Hoeller 56b082dec7 Merge branch '6.2.x' 2025-10-01 19:58:49 +02:00
Juergen Hoeller a6f6ecfe6c Revise getPubliclyAccessibleMethodIfPossible to rely on Module#isExported
This avoids reflection and cache access for regular public and exported types.

Closes gh-35556
2025-10-01 19:56:23 +02:00
Sébastien Deleuze acc3783509 Merge branch '6.2.x' 2025-10-01 19:26:06 +02:00
Juergen Hoeller 3e37279db6 Make CGLIB Enhancer compatible with Kotlin 2.2.20+
This commit refines Enhancer#emitMethods to support the changes
introduced by https://youtrack.jetbrains.com/issue/KT-76667.

See gh-35487
2025-10-01 19:14:14 +02:00
Sébastien Deleuze 5138305e0b Fix SingletonSupplier.ofNullable(T) nullability
See gh-35559
2025-10-01 12:01:17 +02:00
Sébastien Deleuze 1e3f8651b8 Refine SingletonSupplier<T> static methods nullability
SingletonSupplier<T> supplier-based static methods nullability should
be refined to accept in a flexible way nullable or non-nullable T.

Closes gh-35559
2025-10-01 11:38:33 +02:00
Sam Brannen 34be8e266d 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
2025-09-25 11:38:33 +02:00
Sam Brannen 5df082132d Polish contribution
See gh-35535
2025-09-25 10:28:00 +02:00
Yanming Zhou 871076ef97 Add serialVersionUID in LinkedCaseInsensitiveMap
Closes gh-35535

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-09-25 10:27:19 +02:00
Manu Sridharan e834a3a80c Nullability fixes for AtomicReference variables
Closes gh-35514
Signed-off-by: Manu Sridharan <msridhar@gmail.com>
2025-09-25 07:39:44 +02:00
Sébastien Deleuze c79e4e230b Reinstantiate checks for kotlin-reflect
This commit reinstantiates checks for kotlin-reflect (via static final
fields for faster Java code paths and better native code removal) which
were removed as part of gh-34275, which did not consider the
increasingly popular use cases where kotlin-stdlib is present in the
classpath as a transitive dependency in Java applications.

Closes gh-35511
2025-09-22 18:33:38 +02:00
Sébastien Deleuze 7635ac38f6 Use uppercase for classpath-related static final field names
Closes gh-35525
2025-09-22 18:32:14 +02:00
Sam Brannen 8b254ad25e Improve Javadoc for ConcurrencyThrottleSupport 2025-09-22 18:12:31 +02:00
Sam Brannen cb485b666f Polishing 2025-09-18 18:31:29 +02:00
Sébastien Deleuze da0a36bfd6 Upgrade to NullAway 0.12.10 and refine nullability
Closes gh-35492
2025-09-17 15:17:23 +02:00
Sébastien Deleuze 2faed3cdbb Refine PropagationContextElement
This commit apply several refinements to PropagationContextElement:
 - Capture the ThreadLocal when instantiating the
   PropagationContextElement in order to support dispatchers switching
   threads
 - Remove the constructor parameter which is not idiomatic and breaks
   the support when switching threads, and use instead the
   updateThreadContext(context: CoroutineContext) parameter
 - Make the kotlinx-coroutines-reactor dependency optional
 - Make the properties private

The Javadoc and tests are also updated to use the
`Dispatchers.IO + PropagationContextElement()` pattern performed
outside of the suspending lambda, which is the typical use case.

Closes gh-35469
2025-09-12 17:26:07 +02:00
Sam Brannen 15c5cf472b Merge branch '6.2.x' 2025-09-10 14:29:17 +02:00
Sam Brannen 0e3e34bee0 Find annotations on parameters in overridden non-public methods
Prior to this commit, annotations were not found on parameters in an
overridden method unless the method was public. Specifically, the
search algorithm in AnnotatedMethod did not consider a protected or
package-private method in a superclass to be a potential override
candidate. This affects parameter annotation searches in
spring-messaging, spring-webmvc, spring-webflux, and any other
components that use or extend AnnotatedMethod.

To address that, this commit revises the search algorithm in
AnnotatedMethod to consider all non-final declared methods as potential
override candidates, thereby aligning with the search logic in
AnnotationsScanner for the MergedAnnotations API.

Closes gh-35349
2025-09-10 14:24:24 +02:00
Sam Brannen 4745c7cf3c Name local variables consistently 2025-09-10 14:08:20 +02:00
Brian Clozel ef2a403df6 Add PropagationContextElement Kotlin operator
Prior to this commit, the Micrometer context-propagation project would
help propagating information from `ThreadLocal`, Reactor `Context` and
other context objects. This is already well supported for Micrometer
Observations.

In the case of Kotlin suspending functions, the processing of tasks
would not necessarily update the `ThreadLocal` when the function is
scheduled on a different thread.

This commit introduces the `PropagationContextElement` operator that
connects the `ThreadLocal`, Reactor `Context` and Coroutine `Context`
for all libraries using the "context-propagation" project.

Applications must manually use this operator in suspending functions
like so:

```
suspend fun suspendingFunction() {
  return withContext(PropagationContextElement(currentCoroutineContext())) {
    logger.info("Suspending function with traceId")
  }
}
```

Closes gh-35185
2025-09-09 21:42:08 +02:00
Juergen Hoeller 5be5843cb7 Merge branch '6.2.x'
# Conflicts:
#	framework-platform/framework-platform.gradle
2025-09-08 18:23:37 +02:00
Juergen Hoeller 9ba954c330 Fix FileSystemUtils for Windows/Linux path difference
See gh-35443
2025-09-08 17:51:58 +02:00
Juergen Hoeller a053e6594c Merge branch '6.2.x'
# Conflicts:
#	spring-core/src/main/java/org/springframework/core/io/Resource.java
#	spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java
#	spring-core/src/test/java/org/springframework/util/FileSystemUtilsTests.java
#	spring-web/src/main/java/org/springframework/http/codec/ResourceHttpMessageWriter.java
2025-09-08 17:30:43 +02:00
Juergen Hoeller ba52164373 Provide graceful fallback for non-default NIO file systems
Closes gh-35443
2025-09-08 17:28:45 +02:00
Juergen Hoeller 27221581a1 Expose getFilePath() on Resource interface for consistent NIO support
Closes gh-35435
2025-09-08 17:03:07 +02:00
Sam Brannen 114c3f7c9c Avoid unnecessary imports for Javadoc 2025-09-08 15:04:33 +02:00
Sam Brannen 8f34a67024 Polish core retry internals 2025-09-08 15:03:50 +02:00
Sam Brannen e93a6a7230 Improve wording for retry exceptions 2025-09-08 14:39:46 +02:00
Sam Brannen 1786eb2901 Introduce RetryInterruptedException to address off-by-one error
Prior to this commit, a RetryException thrown for an
InterruptedException returned the wrong value from getRetryCount().
Specifically, the count was one more than it should have been, since the
suppressed exception list contains the initial exception as well as all
retry attempt exceptions.

To address that, this commit introduces an internal
RetryInterruptedException which accounts for this off-by-one error.

Closes gh-35434
2025-09-08 14:22:52 +02:00
Sam Brannen b2cdfbadf1 Introduce onRetryPolicyInterruption() callback in RetryListener
In RetryTemplate, if we encounter an InterruptedException while
sleeping for the configured back-off duration, we throw a
RetryException with the InterruptedException as the cause.

However, prior to this commit, that RetryException propagated to the
caller without notifying the registered RetryListener.

To address that, this commit introduces a new
onRetryPolicyInterruption() callback in RetryListener as a companion to
the existing onRetryPolicyExhaustion() callback.

Closes gh-35442
2025-09-08 13:47:23 +02:00
Sam Brannen 7484b9c491 Consistently include exceptions for previous attempts in RetryException
In RetryTemplate, if we encounter an InterruptedException while
sleeping for the configured back-off duration, we throw a
RetryException with the InterruptedException as the cause.

However, in contrast to the specification for RetryException, we do not
currently include the exceptions for previous retry attempts as
suppressed exceptions in the RetryException which is thrown in such
scenarios.

In order to comply with the documented contract for RetryException,
this commit includes exceptions for previous attempts in the
RetryException thrown for an InterruptedException as well.

Closes gh-35434
2025-09-06 16:39:22 +02:00
Sam Brannen 7b2730c271 Include current exception in log message for failed retry attempt
Prior to this commit, we included the initial exception in the log
message for the initial invocation of a retryable operation; however,
we did not include the current exception in the log message for
subsequent attempts.

For consistency, we now include the current exception in log messages
for subsequent retry attempts as well.

Closes gh-35433
2025-09-06 16:16:38 +02:00
Sébastien Deleuze d218b0899a Invalid Nullness information for Kotlin properties
This commit adds support for Kotlin properties to Nullness
forMethodReturnType and forParameter methods.

Closes gh-35419
2025-09-05 17:43:08 +02:00
Sébastien Deleuze d2bdf11b39 Refine Nullness for Kotlin functions returning Unit
Should have unspecified nullness like for Java void/Void.

Closes gh-35420
2025-09-05 11:16:27 +02:00
Park Sung Jun 1653ec3b44 Add tests for applyRelativePath method in StringUtils
Closes gh-35397

Signed-off-by: Park Sung Jun <junstin119@gmail.com>
2025-09-01 09:25:55 +02:00
Brian Clozel 442a2d0ca2 Merge branch '6.2.x' 2025-08-27 13:40:41 +02:00
Brian Clozel 764336f0f2 Fix Jetty DataBufferFactory memory leak
Prior to this commit, gh-32097 added native support for Jetty for both
client and server integrations. The `JettyDataBufferFactory` was
promoted as a first class citizen, extracted from a private class in the
client support. To accomodate with server-side requirements, an extra
`buffer.retain()` call was performed.
While this is useful for server-side support, this introduced a bug in
the data buffer factory, as wrapping an existing chunk means that this
chunk is already retained.

This commit fixes the buffer factory implementation and moved existing
tests from mocks to actual pooled buffer implementations from Jetty.
The extra `buffer.retain()` is now done from the server support, right
before wrapping the buffer.

Fixes gh-35319
2025-08-27 13:36:34 +02:00
Brian Clozel 81b4020fc6 Do not load concrete types in annotation metadata
This change fixes a regression introduced in the previous commit.

Closes gh-35252
2025-08-26 21:58:15 +02:00
Brian Clozel 2b7f88ee44 Fix annotation arrays support in ClassFile metadata
As of gh-33616, Spring now supports metadata reading with the ClassFile
API on JDK 24+ runtimes. This commit fixes a bug where
`ArrayStoreException` were thrown when reading annotation attribute
values for arrays.

Fixes gh-35252
2025-08-26 18:40:35 +02:00
Sam Brannen 606b689fb1 Merge branch '6.2.x' 2025-08-24 14:02:27 +02:00
Sam Brannen 6978f0a398 Document terms and units in DataSize.parse(...) methods
Closes gh-35298
2025-08-24 14:02:04 +02:00
Juergen Hoeller a1f5f6aa92 Merge branch '6.2.x' 2025-08-24 10:32:31 +02:00
Juergen Hoeller f62519bb55 Add cancelRemainingTasksOnClose flag for enforcing early interruption
Closes gh-35372
2025-08-24 10:31:01 +02:00
Brian Clozel d128dd2616 Make StartupStep AutoCloseable
This commit mames `StartupStep` extend `AutoCloseable` in order to allow
the try/with resources syntax and making the `step.end()` call
transparent.

Closes gh-35277
2025-08-22 19:24:11 +02:00