Commit Graph

4100 Commits

Author SHA1 Message Date
Juergen Hoeller f7e7d1b7b0 Merge branch '6.1.x' 2024-06-03 12:47:17 +02:00
Juergen Hoeller b08883b65c Avoid NoSuchMethodException for annotation attribute checks
Closes gh-32921
2024-06-03 12:45:11 +02:00
Juergen Hoeller 8f21137883 Merge branch '6.1.x' 2024-05-28 18:47:38 +02:00
Juergen Hoeller 557dbba585 Remove superfluous addToClassHierarchy call for Enum types
Closes gh-32906
2024-05-28 18:45:05 +02:00
Juergen Hoeller 49caa02584 Merge branch '6.1.x' 2024-05-24 13:06:21 +02:00
Juergen Hoeller 26d1c38d84 Polishing 2024-05-24 13:05:49 +02:00
Juergen Hoeller dae4366325 Merge branch '6.1.x' 2024-05-24 11:55:53 +02:00
Juergen Hoeller 345daaabbc Detect original generic method for CGLIB bridge method
Closes gh-32888
2024-05-24 11:49:10 +02:00
Arjen Poutsma 903493e9a9 Various MultiValueMap improvements
This commit makes several improvements to MultiValueMap:
- asSingleValueMap offers a single-value view (as opposed to the
  existing toSingleValueMap, which offers a copy)
- fromSingleValue is a static method that adapts a Map<?,?> to the
  MultiValueMap interface
- fromMultiValue is a static method that adapts a Map<?,List<?>> to the
  MultiValueMap interface

Closes gh-32832
2024-05-24 11:44:55 +02:00
Stéphane Nicoll 94348d9d41 Revert "Merge pull request #32876 from quaff"
This reverts commit 3b2a4da023, reversing
changes made to 181b68088a.

See gh-32876
2024-05-23 13:13:02 +02:00
Stéphane Nicoll 79b5ee75d3 Polish "Extend nested placeholders resolution to any CharSequence"
See gh-32876
2024-05-23 08:36:34 +02:00
Yanming Zhou 5a7bfa9dec Extend nested placeholders resolution to any CharSequence
See gh-32876
2024-05-23 08:36:15 +02:00
Juergen Hoeller 7d8279afec Merge branch '6.1.x' 2024-05-15 14:16:51 +02:00
Juergen Hoeller e4e6910122 Polishing 2024-05-15 14:15:52 +02:00
Juergen Hoeller 2270df515b Enforce cleaned URL for root resource from ClassLoader
Closes gh-32828
2024-05-15 14:15:47 +02:00
Juergen Hoeller 60c5f44e1d Upgrade reactor.util.annotation content
See gh-32785
2024-05-14 22:59:43 +02:00
Juergen Hoeller 7c534eeeeb Merge branch '6.1.x'
# Conflicts:
#	framework-platform/framework-platform.gradle
2024-05-14 22:02:32 +02:00
Juergen Hoeller e509385eae Add InputStreamResource(InputStreamSource) constructor for lambda expressions
Includes notes for reliable InputStream closing, in particular with Spring MVC.

Closes gh-32802
2024-05-14 21:59:42 +02:00
Brian Clozel f7a6a7b814 Allow ReflectionHints to register hints on interface hierarchies
This commit promotes a previously private method in
`BeanRegistrationsAotContribution` to a top-level method in
`ReflectionHints`.

This helps to register hints on all interfaces implemented in the class
hierarchy of the given type.

Closes gh-32824
2024-05-14 17:54:12 +02:00
Juergen Hoeller 9516f87e5e Merge branch '6.1.x' 2024-05-14 13:48:01 +02:00
Juergen Hoeller b7aafda872 Polishing 2024-05-14 13:43:35 +02:00
Juergen Hoeller b2d43f54e0 Merge branch '6.1.x' 2024-05-10 12:29:49 +02:00
Juergen Hoeller bf08e0c1b4 Polishing 2024-05-10 12:27:29 +02:00
Sébastien Deleuze 8ac39d0062 Polishing 2024-05-10 11:57:42 +02:00
Sébastien Deleuze 7985ab33f4 Throw an exception for suspending factory methods
Suspending factory methods are not supported, and can
have side effects, so it is better to fail explicitly
for such use case.

Closes gh-32719
2024-05-10 11:56:50 +02:00
Yanming Zhou a02861f7db Insist on using `CollectionUtils.isEmpty()` and `StringUtils.hasLength()`
search `(\w+) != null && !(\1).isEmpty\(\)`
2024-05-09 09:25:09 +02:00
Juergen Hoeller 7b16988ec9 Merge branch '6.1.x' 2024-05-08 17:52:42 +02:00
Juergen Hoeller 0eb937a866 Document limitations of CGLIB proxy class generation in JPMS module setups
Includes extended exception messages with common hints and explanations.

Closes gh-32671
2024-05-08 17:51:17 +02:00
Juergen Hoeller 645556a28c Merge branch '6.1.x' 2024-05-07 15:53:00 +02:00
Juergen Hoeller 4f02be263f Polishing 2024-05-07 15:52:13 +02:00
Juergen Hoeller d9ca263065 Merge branch '6.1.x' 2024-05-06 20:11:56 +02:00
Juergen Hoeller 05d9b52b19 Polishing 2024-05-06 20:10:40 +02:00
Sam Brannen b0a2f269cb Merge branch '6.1.x' 2024-05-03 12:18:34 +03:00
Sam Brannen 4baad16437 Include repeatable annotation container in MergedAnnotations results
A bug has existed in Spring's MergedAnnotations support since it was
introduced in Spring Framework 5.2. Specifically, if the
MergedAnnotations API is used to search for annotations with "standard
repeatable annotation" support enabled (which is the default), it's
possible to search for a repeatable annotation but not for the
repeatable annotation's container annotation.

The reason is that MergedAnnotationFinder.process(Object, int, Object,
Annotation) does not process the container annotation and instead only
processes the "contained" annotations, which prevents a container
annotation from being included in search results.

In #29685, we fixed a bug that prevented the MergedAnnotations support
from recognizing an annotation as a container if the container
annotation declares attributes other than the required `value`
attribute. As a consequence of that bug fix, since Spring Framework
5.3.25, the MergedAnnotations infrastructure considers such an
annotation a container, and due to the aforementioned bug the container
is no longer processed, which results in a regression in behavior for
annotation searches for such a container annotation.

This commit addresses the original bug as well as the regression by
processing container annotations in addition to the contained
repeatable annotations.

See gh-29685
Closes gh-32731
2024-05-03 12:18:04 +03:00
Stéphane Nicoll 305ebca56d Merge branch '6.1.x' 2024-05-02 17:02:08 +02:00
Stéphane Nicoll abcc1dfc6c Review usage of BindingReflectionHintsRegistrar#registerReflectionHints
Closes gh-32753
2024-05-02 16:53:59 +02:00
Sam Brannen 1ffd0dcf06 Merge branch '6.1.x' 2024-05-02 13:29:08 +03:00
Sam Brannen 5a24e94d2e Polish tests 2024-05-02 13:28:48 +03:00
Arjen Poutsma 3897ea78bb Resolve collisions in composite collections
Before this commit, creating a CompositeMap from two maps with the same
key has strange results, such as entrySet returning duplicate entries
with the same key.

After this commit, we give precedence to the first map by filtering out
all entries in the second map that are also mapped by the first map.

See gh-32245
2024-05-02 10:51:57 +02:00
Juergen Hoeller 649a537891 Merge branch '6.1.x' 2024-05-01 15:42:14 +02:00
Juergen Hoeller 610626aec6 Ignore non-String keys in PropertiesPropertySource.getPropertyNames()
Closes gh-32742
2024-05-01 15:41:26 +02:00
Juergen Hoeller adc7f73170 Merge branch '6.1.x' 2024-04-23 13:17:08 +02:00
Juergen Hoeller 0b9b9b4602 Avoid overreading of InputStream in copyRange
Closes gh-32695
2024-04-23 13:16:28 +02:00
Juergen Hoeller 6a1ec0ed73 Merge branch '6.1.x' 2024-04-22 13:43:57 +02:00
Juergen Hoeller ec1f5ca600 Polishing 2024-04-22 13:43:07 +02:00
Juergen Hoeller 62efdfb89c Try early initialization for all user-declared methods (including interfaces)
Closes gh-32682
2024-04-22 13:43:02 +02:00
laterlaugh 5012843b12 Fix typos in comment and test
Closes gh-32628
2024-04-12 17:40:54 +02:00
Sébastien Deleuze d6e9562aeb Revert "Prevent compilation warnings with `@Nullable`"
This reverts commit dc242df533.
2024-04-10 14:39:47 +02:00
Juergen Hoeller f6089afd0e Use ClassLoaderAwareGeneratorStrategy with UndeclaredThrowableStrategy delegate
See gh-32469
2024-04-10 13:23:24 +02:00
Mikaël Francoeur 561583842f
Consistent handling of undeclared checked exceptions in CGLIB proxies (#32469)
Co-authored-by: hengyunabc <hengyunabc@gmail.com>
Co-authored-by: Mikaël Francoeur <mikael.francoeur@ticketmaster.com>
2024-04-10 12:11:33 +02:00
Sam Brannen 0637b699cd Merge branch '6.1.x' 2024-04-09 19:01:38 +02:00
Sam Brannen e702733c7b Detect bridge methods across ApplicationContexts in MethodIntrospector
Prior to this commit, MethodIntrospector failed to properly detect
bridge methods for subsequent invocations of selectMethods() with the
same targetType and MetadataLookup, if such subsequent invocations
occurred after the ApplicationContext had been refreshed.

The reason this occurs is due to the following.

- Class#getDeclaredMethods() always returns "child copies" of the
  underlying Method instances -- which means that `equals()` should be
  used instead of `==` whenever the compared Method instances can come
  from different sources (such as the static caches mentioned below).

- BridgeMethodResolver caches resolved bridge methods in a static cache
  -- which is never cleared.

- ReflectionUtils caches declared methods in a static cache
  -- which gets cleared when an ApplicationContext is refreshed.

Consequently, if you attempt to load an ApplicationContext twice in the
same ClassLoader, the second attempt uses the existing, populated cache
for bridged methods but a cleared, empty cache for declared methods.
This results in new invocations of Class#getDeclaredMethods(), and
identity checks with `==` then fail to detect equivalent bridge methods.

This commit addresses this by additionally comparing bridge methods
using `equals()` in MethodIntrospector.selectMethods().

Note that the `==` checks remain in place as an optimization for when
`equals()` is unnecessary.

Closes gh-32586
2024-04-09 18:56:41 +02:00
Sam Brannen 187f641409 Polishing 2024-04-09 18:55:39 +02:00
Sébastien Deleuze dc242df533 Prevent compilation warnings with `@Nullable`
This commit replaces `@Nonnull(when = When.MAYBE)` meta-annotation in
`org.springframework.lang.Nullable` by `@CheckForNull` in order to
prevent `unknown enum constant When.MAYBE` compilation warnings.

Closes gh-27183
2024-04-09 13:35:49 +02:00
Juergen Hoeller 03dd8e20e2 Merge branch '6.1.x' 2024-04-05 18:05:37 +02:00
Juergen Hoeller 84963ba4d8 Polishing 2024-04-05 18:04:08 +02:00
Sam Brannen d360def92e Polishing 2024-03-30 16:06:06 +01:00
Łukasz Jernaś 86b87d7d85
Prevent package summaries from being truncated due to incorrect sentence detection
Javadoc doesn't seem to like having `e.g.` as it thinks the sentence
ends there, which is usually incorrect and results in broken descriptions.

This commit rewords the doc strings slightly to avoid problematic parts.

Closes gh-32532
2024-03-30 15:44:41 +01:00
Sébastien Deleuze cf87441a26 Remove unnecessary method.isAccessible() invocation
Closes gh-32548
2024-03-28 11:50:29 +01:00
Sébastien Deleuze dc982d0d51 Merge branch '6.1.x' 2024-03-28 11:14:42 +01:00
Sébastien Deleuze 048e4f0aa2 Invoke KCallablesJvm.setAccessible only when required
Closes-32536
2024-03-28 11:12:50 +01:00
T45K b28153e1d7 Fix handling of value class with private constructor
See gh-32536
2024-03-28 11:11:58 +01:00
Stéphane Nicoll bf5b22d64f Merge branch '6.1.x' 2024-03-26 17:45:25 +01:00
Stéphane Nicoll c7c9da56da Consistent atMost period for Awaitility-based tests
Closes gh-32537
2024-03-26 17:45:14 +01:00
Sébastien Deleuze 8b51b36729 Perform NullAway build-time checks in more modules
This commit enables null-safety build-time checks in
all remaining modules except spring-test.

See gh-32475
2024-03-26 15:53:01 +01:00
Sébastien Deleuze 2fea3d7921 Merge branch '6.1.x' 2024-03-26 15:41:46 +01:00
Sébastien Deleuze 290a41d398 Refine null-safety in more modules
This commit refines the null-safety in all remaining modules
except spring-test.

See gh-32475
2024-03-26 15:39:18 +01:00
Sébastien Deleuze 3b4f8dbb8e Merge branch '6.1.x' 2024-03-26 09:47:09 +01:00
Sébastien Deleuze 1b563f8ba4 Refine null-safety in more modules
This commit refines the null-safety in:
 - spring-jdbc
 - spring-r2dbc
 - spring-orm
 - spring-beans
 - spring-aop

See gh-32475
2024-03-26 09:46:34 +01:00
Sébastien Deleuze e52ee01ec8 Perform NullAway build-time checks in spring-web
Also in spring-websocket.

See gh-32475
2024-03-25 11:11:09 +01:00
Sébastien Deleuze b1b9ee0ccf Merge branch '6.1.x' 2024-03-21 17:56:14 +01:00
Sébastien Deleuze 1e80694daf Fix a regression with Kotlin generic controllers
This commit reintroduces a more defensive parameter type check that
skips KClass casting for generic parameters.

Closes gh-32510
2024-03-21 17:55:57 +01:00
Sébastien Deleuze f648fd7c3b Perform NullAway build-time checks in spring-expression
See gh-32475
2024-03-20 10:10:00 +01:00
Sébastien Deleuze 1ccd5512c5 Merge branch '6.1.x' 2024-03-20 10:08:30 +01:00
Sébastien Deleuze 2e98a8a2a4 Refine null-safety in spring-expression
See gh-32475
2024-03-20 10:07:56 +01:00
Sébastien Deleuze 4c7735016b Refine null-safety with NullAway build-time checks
This commit introduces null-safety checks for spring-core at build-time
in order to validate the consistency of Spring null-safety annotations
and generate errors when inconsistencies are detected during a build
(similar to what is done with Checkstyle).

In order to make that possible, this commit also introduces a new
org.springframework.lang.Contract annotation inspired from
org.jetbrains.annotations.Contract, which allows to specify semantics
of methods like Assert#notNull in order to prevent artificial
additional null checks in Spring Framework code base.

This commit only checks org.springframework.core package, follow-up
commits will also extend the analysis to other modules, after related
null-safety refinements.

See gh-32475
2024-03-19 16:30:32 +01:00
Sébastien Deleuze 8d23ec4747 Merge branch '6.1.x' 2024-03-19 13:36:39 +01:00
Sébastien Deleuze aa0fb97ba5 Nullability refinements
See gh-32475
2024-03-19 13:32:13 +01:00
Juergen Hoeller 14bc0d6469 Fix typo in condition check
See gh-21190
2024-03-19 13:17:33 +01:00
Juergen Hoeller e58ea0d945 Merge branch '6.1.x'
# Conflicts:
#	spring-core/src/main/java/org/springframework/core/CoroutinesUtils.java
2024-03-19 10:06:48 +01:00
Juergen Hoeller bd27ddf83a Polishing (aligned with main) 2024-03-19 10:05:32 +01:00
Juergen Hoeller c531a8a705 Nullability refinements and related polishing
See gh-32475
2024-03-19 09:58:44 +01:00
Juergen Hoeller 6df27644eb Merge branch '6.1.x' 2024-03-18 16:04:26 +01:00
Juergen Hoeller 5dc6a16c0b Nullability refinements
See gh-32475
2024-03-18 16:03:00 +01:00
Juergen Hoeller 2f2c4188e5 Nullability refinements
See gh-32475
2024-03-18 15:49:20 +01:00
Sam Brannen ccebaa6b0c Merge branch '6.1.x' 2024-03-18 15:18:06 +01:00
Sam Brannen 42a4f28962 Avoid unnecessary Annotation array cloning in TypeDescriptor
Closes gh-32476
2024-03-18 15:17:04 +01:00
Juergen Hoeller 2b56ca08d4 Restore canonical name representation for 6.2
See gh-32405
2024-03-17 21:03:02 +01:00
Juergen Hoeller b89cf2b16a Merge branch '6.1.x' 2024-03-17 21:00:00 +01:00
Juergen Hoeller b1c3b6e34b Restore original toString representation (revert accidental backport)
See gh-32405
2024-03-17 20:42:29 +01:00
Johnny Lim 99e1b0d117 Make SimpleAliasRegistry.aliasNames final 2024-03-17 13:33:31 +01:00
Juergen Hoeller 89d563097f Merge branch '6.1.x'
# Conflicts:
#	spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java
2024-03-16 23:24:51 +01:00
Juergen Hoeller eb8b7c4331 Remove superfluous @NonNull declarations 2024-03-16 14:22:17 +01:00
Juergen Hoeller 58bd057a24 Avoid cloning empty Annotation array in TypeDescriptor (backport)
Closes gh-32405
2024-03-16 14:21:34 +01:00
Sam Brannen e1b1435a00 Stop referring to JDK 1.5 plus polishing 2024-03-14 16:00:51 +01:00
Sam Brannen 986c4fd926 Revise use of Objects.requireNonNull()
Historically, we have rarely intentionally thrown a
NullPointerException in the Spring Framework. Instead, we prefer to
throw either an IllegalArgumentException or IllegalStateException
instead of a NullPointerException.

However, changes to the code in recent times have introduced the use of
Objects.requireNonNull(Object) which throws a NullPointerException
without an explicit error message.

The latter ends up providing less context than a NullPointerException
thrown by the JVM (since Java 14) due to actually de-referencing a
null-pointer. See https://openjdk.org/jeps/358.

In light of that, this commit revises our current use of
Objects.requireNonNull(Object) by removing it or replacing it with
Assert.notNull().

However, we still use Objects.requireNonNull(T, String) in a few places
where we are required to throw a NullPointerException in order to
comply with a third-party contract such as Reactive Streams.

Closes gh-32430
2024-03-13 16:00:22 +01:00
Juergen Hoeller 3b87c87a33 Merge branch '6.1.x' 2024-03-12 20:11:21 +01:00
Juergen Hoeller 723c94e5ac Polishing 2024-03-12 20:10:01 +01:00
Sébastien Deleuze 0435e9c49e Merge branch '6.1.x' 2024-03-11 13:40:23 +01:00
Sébastien Deleuze 80f3be6577 Replace getJvmErasure by getClassifier
Should be slightly faster.

See gh-32334
2024-03-11 13:37:41 +01:00
Sébastien Deleuze 946082f806 Refine publisher type check in CoroutinesUtils
See gh-32390
2024-03-11 13:15:54 +01:00
Yanming Zhou 246e4977a2 Polishing Optional usage 2024-03-11 09:13:49 +01:00
Sam Brannen 4c246b7c96 Consistently use canonical annotation names in string representations 2024-03-10 15:54:53 +01:00
Sam Brannen 5345a13918 Polish contribution
See gh-32405
2024-03-10 12:36:08 +01:00
Patrick Strawderman 7fa2a28970 Avoid cloning empty Annotation array in TypeDescriptor
Rework AnnotatedElementAdapter to avoid cloning the underlying
Annotation array if it is empty when getAnnotations() is called.

Additionally, make the class static and add a factory method that
returns a singleton instance for null or empty Annotation arrays.

Closes gh-32405
2024-03-10 12:26:49 +01:00
Stéphane Nicoll e53ed3e3c6 Merge branch '6.1.x' 2024-03-09 16:03:04 +01:00
Stéphane Nicoll 4983a802a7 Polish "Fix Javadoc"
See gh-32403
2024-03-09 16:02:01 +01:00
Maksim Sasnouski abdccffa39 Fix Javadoc
This commit fixes various Javadoc issues across the code base.

See gh-32403
2024-03-09 16:02:00 +01:00
Juergen Hoeller c1287d48e2 Polishing 2024-03-08 19:31:01 +01:00
Juergen Hoeller 19fec0633f Local root directory and jar caching in PathMatchingResourcePatternResolver
Closes gh-21190
2024-03-08 19:12:14 +01:00
Sam Brannen ae6c64abc5 Fix Javadoc errors 2024-03-08 11:59:53 +01:00
Sébastien Deleuze f0039833c8 Merge branch '6.1.x' 2024-03-07 14:31:26 +01:00
Sébastien Deleuze 579dbc48d7 Optimize Coroutine invocations
KClass instantiation in CoroutinesUtils is suboptimal, and should be
replaced by KTypes#isSubtypeOf checks using pre-instantiated types for
Flow, Mono and Publisher.

This commit impact on performances is significant since a throughput
increase between 2x and 3x has been measured on basic endpoints.

Closes gh-32390
2024-03-07 14:27:47 +01:00
Sébastien Deleuze 92f4e883b3 Merge branch '6.1.x' 2024-03-07 11:11:46 +01:00
Sébastien Deleuze c1d4b610ca Refine Kotlin inline class optimizations
Closes gh-32334
2024-03-07 11:11:20 +01:00
Sam Brannen b32a2cadfb Update class-level Javadoc for ParameterNameDiscoverer 2024-03-06 14:49:46 +01:00
Juergen Hoeller a0ae849856 Polishing 2024-03-05 18:23:13 +01:00
ali dandach eb01cc0d9d Use String#isEmpty where feasible
This commit replaces checks for empty strings ("".equals(...)) with the
String#isEmpty method.

Closes gh-32377
2024-03-05 17:38:29 +01:00
Sam Brannen c29c67839b Cache parameterTypes in ClassUtils.getInterfaceMethodIfPossible 2024-03-05 11:48:01 +01:00
Arjen Poutsma 6d9aba88d0 Fix typo
See gh-32360
2024-03-05 10:48:06 +01:00
Arjen Poutsma 646bd7f893 Document StringUtils::uriDecode limitations
Closes gh-32360
2024-03-05 10:03:15 +01:00
Juergen Hoeller 79c54098ab Merge branch '6.1.x' 2024-03-04 23:49:55 +01:00
Juergen Hoeller 4300fec023 Restore ability to return original method at ClassUtils level as well
Closes gh-32365
2024-03-04 23:48:26 +01:00
Juergen Hoeller dc6c96de0a Merge branch '6.1.x'
# Conflicts:
#	spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractFallbackJCacheOperationSource.java
#	spring-context/src/main/java/org/springframework/cache/interceptor/AbstractFallbackCacheOperationSource.java
#	spring-tx/src/main/java/org/springframework/transaction/interceptor/AbstractFallbackTransactionAttributeSource.java
2024-03-04 22:50:22 +01:00
Juergen Hoeller e9110c0729 Polishing 2024-03-04 22:48:52 +01:00
Juergen Hoeller 24759a75f4 Restore ability to return original method for proxy-derived method
Closes gh-32365
2024-03-04 22:48:46 +01:00
Sébastien Deleuze 219004ef13 Merge branch '6.1.x' 2024-03-03 22:26:37 +01:00
Sébastien Deleuze 516a203703 Support nullable Kotlin value class arguments
This commit skips the value class parameter instantiation for nullable
types when a null argument is passed.

Closes gh-32353
2024-03-03 22:26:21 +01:00
Juergen Hoeller 390fe0fe78 Add support for resolving multiple bounds in type variables
Closes gh-22902
See gh-32327
2024-03-02 11:30:17 +01:00
Stéphane Nicoll ac1a030c35 Make PlaceholderResolutionException extend from IllegalArgumentException
To smooth upgrade from 6.1.x, this commit makes sure that code that used
to catch an IAE to ignore a faulty placeholder resolution still works.

See gh-9628
2024-03-02 08:28:38 +01:00
Sébastien Deleuze 4149d5cb2b Merge branch '6.1.x' 2024-03-01 11:55:08 +01:00
Sébastien Deleuze 85a781d517 Instantiate value class parameters with Kotlin reflection
In order to invoke the init block and to improve the maintainability.

Closes gh-32324
2024-03-01 11:50:19 +01:00
Sébastien Deleuze 7c5bcbcba4 Merge branch '6.1.x' 2024-02-28 17:24:08 +01:00
Sébastien Deleuze 45c21042f6 Optimize Kotlin inline class checks
This commit fixes a performance regression caused by gh-31698,
and more specifically by KClass#isValue invocations which are slow since
they load the whole module to find the class to get the descriptor.

After discussing with the Kotlin team, it has been decided that only
checking for the presence of `@JvmInline` annotation is enough for
Spring use case.

As a consequence, this commit introduces a new
KotlinDetector#isInlineClass method that performs such check, and
BeanUtils, CoroutinesUtils and WebMVC/WebFlux InvocableHandlerMethod
have been refined to leverage it.

Closes gh-32334
2024-02-28 17:18:57 +01:00
Juergen Hoeller 479879c53a Polishing 2024-02-26 13:40:21 +01:00
Juergen Hoeller 9198774f13 Detect wildcard without bounds returned from VariableResolver as well
See gh-32327
See gh-20727
2024-02-25 16:32:11 +01:00
Juergen Hoeller 260404b7f2 Consistently detect wildcard without bounds as unresolvable
Closes gh-32327
See gh-20727
2024-02-24 20:25:56 +01:00
Sam Brannen f59c4023e9 Polishing 2024-02-23 14:46:12 +01:00
Sam Brannen eab1a3dc6b Fix BridgeMethodResolverTests.isBridgeMethodFor() in Eclipse IDE 2024-02-23 12:57:14 +01:00
Sam Brannen 4b5e96578d Extract runningInEclipse() into IdeUtils test fixture 2024-02-23 12:57:06 +01:00
Sam Brannen 122372c580 Spring cleaning: update copyright headers 2024-02-23 12:21:22 +01:00
Sam Brannen c98bebd6d3 Spring cleaning: add missing @⁠Override annotations 2024-02-23 12:20:11 +01:00
Sam Brannen d0ffc16efc Spring cleaning: avoid unnecessary static imports 2024-02-23 12:20:11 +01:00
Sam Brannen 4bd1485ce4 Spring cleaning: use method references 2024-02-23 12:20:11 +01:00
Sam Brannen 4339c8eac2 Spring cleaning: use diamond operator 2024-02-23 12:20:11 +01:00
Arjen Poutsma aee03c5201 Use composite collections in attribute merging
This commit introduces composite collections (i.e. Collection, Set, Map)
and uses these composites in request predicates, where before new
collections were instantiated.

Closes gh-32245
2024-02-22 13:11:20 +01:00
Sam Brannen 644887e094 Polish (Linked)HashSet usage
See gh-32291
2024-02-21 16:22:31 +01:00
Sam Brannen b9c304b890 Polish contribution
See gh-32291
2024-02-21 16:19:53 +01:00
Patrick Strawderman e1a32d4ba9 Avoid resizing of fixed-size HashSet/LinkedHashSet variants
Add helpers to CollectionUtils for building HashSets and LinkedHashSets
that can hold an expected number of elements without needing to
resize/rehash.

Closes gh-32291
2024-02-21 16:19:53 +01:00
Sam Brannen 3fb170058f Polish contribution
See gh-32294
2024-02-21 14:09:09 +01:00
Patrick Strawderman f9fe8efb2e Use ConcurrentHashMap.newKeySet
In places where a ConcurrentHashMap was used as a set by wrapping it
with Collections.newSetFromMap, switch to just using the set returned
by ConcurrentHashMap.newKeySet directly.

Closes gh-32294
2024-02-21 14:08:38 +01:00
Arjen Poutsma c077805761 Set correct capacity in DefaultDataBuffer::setNativeBuffer
Closes gh-30984
2024-02-20 12:36:55 +01:00
Arjen Poutsma 70004e9ad0 Polishing external contribution
Change position and limit on duplicate, rather than source.

See gh-30967
Closes gh-32009
2024-02-20 12:12:35 +01:00
injae-kim 969d0bd08b Set correct limit in DefaultDataBuffer::getNativeBuffer
Closes gh-30967
2024-02-20 12:12:35 +01:00
Juergen Hoeller 0ddfe3977a Merge branch '6.1.x' 2024-02-16 22:50:04 +01:00
Juergen Hoeller 3aae7a66e6 Polishing 2024-02-16 22:27:09 +01:00
Sam Brannen a85bf3185e Remove APIs deprecated for removal in 6.2
This commit removes the following obsolete and deprecated APIs.

- org.springframework.util.Base64Utils

- org.springframework.cache.jcache.interceptor.JCacheOperationSourcePointcut

- org.springframework.http.client.AbstractClientHttpResponse

- org.springframework.http.client.ClientHttpResponse.getRawStatusCode()

- org.springframework.http.client.observation.ClientHttpObservationDocumentation.HighCardinalityKeyNames.CLIENT_NAME

- org.springframework.web.reactive.function.client.ClientHttpObservationDocumentation.HighCardinalityKeyNames.CLIENT_NAME

- org.springframework.web.filter.reactive.ServerWebExchangeContextFilter.get(Context)

- org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler.handleBindException(...)

- org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver.handleBindException(...)

Closes gh-30608
2024-02-16 16:45:18 +01:00
Sam Brannen 6d5bf6d9b3 Ensure alias resolution in SimpleAliasRegistry depends on registration order
Closes gh-32024
2024-02-16 15:22:27 +01:00
Sam Brannen ea4e7df9ca Consistently declare ignoreUnresolvablePlaceholders as last argument 2024-02-16 15:00:32 +01:00
Sam Brannen 7c07c43201 Polishing 2024-02-16 15:00:06 +01:00
Sam Brannen fc9a118406 Polish SimpleCommandLinePropertySource support 2024-02-16 11:41:22 +01:00
Juergen Hoeller ea3573176a Avoid infinite recursion for self-referencing generic type
Closes gh-32282
See gh-30079
2024-02-16 11:15:02 +01:00
Stéphane Nicoll bcf235cc66 Merge branch '6.1.x' 2024-02-16 08:36:26 +01:00
Stéphane Nicoll 6b8105aef2 Update copyright year of changed files
See gh-32281
2024-02-16 08:33:17 +01:00
Patrick Strawderman 481283d2f1 Use Spliterator of underlying collection
Delegate to the spliterator method of the underlying collection in
MutablePropertyValues and MutablePropertySources. In both cases, those
collection types have specialized Spliterator implementations.
Delegating to these Spliterators also means the characteristics of the
Spliterator are properly set.

See gh-32281
2024-02-16 08:32:41 +01:00
Juergen Hoeller 7e67da8a26 Support for matching partial generics
Closes gh-20727
2024-02-15 16:51:09 +01:00
Juergen Hoeller d4e8daaede Add javadoc note on recursive resolution as of 6.2
See gh-30079
2024-02-15 16:50:53 +01:00
Yanming Zhou e788aeb25b Improve GenericTypeResolver to resolve type variable recursively
Fix GH-24963
2024-02-15 16:28:45 +01:00
Stéphane Nicoll e3aa5b6b11 Use new implementation in PropertyPlaceholderHelper
This commit removes the previous implementation in favor of the new
PlaceholderParser. The only noticeable side effect is that the exception
is no longer an IllegalArgumentException, but rather the dedicated
PlaceholderResolutionException.

See gh-9628
2024-02-15 15:27:13 +01:00
Stéphane Nicoll 00e05e603d Add new property placeholder implementation
This commit provides a rewrite of the parser for properties containing
potentially placeholders.

Assuming a source where `firstName` = `John` and `lastName` = `Smith`,
the "${firstName}-${lastName}" property is evaluated as "John-Smith".

Compared with the existing implementation in PropertyPlaceholderHelper,
the new implementation offers the following extra features:

1. Placeholder can be escaped using a configurable escape character.
When a placeholder is escaped it is rendered as is. This does apply to
any nested placeholder that wouldn't be escaped. For instance,
"\${firstName}" is evaluated as "${firstName}".
2. The default separator can also be escaped the same way. When the
separator is escaped, the left and right parts are not considered as
the key and the default value respectively. Rather the two parts
combined, including the separator (but not the escape separator) are
used for resolution. For instance, ${java\:comp/env/test} is looking
for a "java:comp/env/test" property.
3. Placeholders are resolved lazily. Previously, all nested placeholders
were resolved before considering if a separator was present. This
implementation only attempts the resolution of the default value if the
key does not provide a value.
4. Failure to resolve a placeholder are more rich, with a dedicated
PlaceholderResolutionException that contains the resolution chain.

See gh-9628
See gh-26268
2024-02-15 15:27:13 +01:00
Brian Clozel b4131ce131 Support "--" end of options in SimpleCommandLineArgsParser
Prior to this commit, the `SimpleCommandLineArgsParser` would reject
"--" arguments as invalid. As reported by the community, the POSIX
utility conventions (Guideline 10) state that

> The first -- argument that is not an option-argument should be
> accepted as a delimiter indicating the end of options.
> Any following arguments should be treated as operands, even if they
> begin with the '-' character.

This commit updates `SimpleCommandLineArgsParser` to not reject "--"
arguments and instead to consider remaining arguments as non-optional.

See gh-31513
2024-02-15 15:06:17 +01:00
Sam Brannen 10bc93c058 Polishing 2024-02-13 17:22:35 +01:00
Simon Baslé 9b93c948a7 Infer reflection hints for Jackson annotations `builder` attributes
This notably enables Jackson to reflectively call a user-provided
builder class and invoke its declared methods (setters and build) in
a native app.

Closes gh-32238
2024-02-13 15:14:08 +01:00
Juergen Hoeller 0b09f1e12f Use ReentrantLock instead of synchronization for concurrency throttle
Closes gh-32251
2024-02-13 11:03:40 +01:00
Juergen Hoeller a2000dba33 Leniently accept tasks after context close in lifecycle stop phase
Schedulers remain strict, just plain executors are lenient on shutdown now.
An early shutdown for executors can be enforced via setStrictEarlyShutdown.

Closes gh-32226
2024-02-11 21:33:53 +01:00
Sam Brannen 052bbcc530 Cache parameter types array in ClassUtils.findInterfaceMethodIfPossible() 2024-02-08 18:14:22 +01:00
Juergen Hoeller 1a783f41aa Use target class for candidate retrieval but not for method matching
Closes gh-32181
See gh-21843
2024-02-01 18:59:45 +01:00
Juergen Hoeller 00577ed80a Polishing 2024-01-31 17:12:20 +01:00
Sam Brannen 067638ae6e Introduce ClassUtils.isVoidType() utility method 2024-01-30 16:27:34 +01:00
Sam Brannen db535863dd Consistently use class literals for primitive types
To improve consistency and avoid confusion regarding primitive types
and their wrapper types, this commit ensures that we always use class
literals for primitive types.

For example, instead of using the `Void.TYPE` constant, we now
consistently use `void.class`.
2024-01-30 15:26:12 +01:00
Sam Brannen f6d8443781 Fix logic in SupplierUtils 2024-01-29 16:07:44 +01:00
Juergen Hoeller 7e5efdd8dd Reuse MapPropertySource for DynamicValuesPropertySource implementation
Closes gh-32110
2024-01-29 13:04:02 +01:00
Juergen Hoeller c6121da151 Polishing 2024-01-24 22:30:33 +01:00
Juergen Hoeller 5656eaccb7 Avoid bridge resolution for method from unrelated class hierarchy
Closes gh-32087
2024-01-23 10:50:53 +01:00
mnhock 1e71d3d363 Use 'Map.getOrDefault' rather than explicit check with fallback
See gh-32072
2024-01-20 14:37:23 +01:00
Stéphane Nicoll 9c6e55939e Improve toString of ExponentialBackOff
Closes gh-32061
2024-01-19 12:10:36 +01:00
Sam Brannen fdf187ec46 Polishing 2024-01-15 15:45:33 +01:00
Stéphane Nicoll 0c42965fc3 Polish 2024-01-15 11:17:19 +01:00
Sam Brannen e1236a8672 Polishing 2024-01-14 16:00:50 +01:00
Sam Brannen 7daff59cb1 Fix alias resolution error message in SimpleAliasRegistry
Prior to this commit, the alias resolution error message in
SimpleAliasRegistry was misleading.

When a resolution conflict is detected, the IllegalStateException
thrown by resolveAliases(...) now states that the resolved alias is
already registered for an `existingName` instead of the `registeredName`.

See gh-31353
Closes gh-32025
2024-01-14 15:19:18 +01:00
Sam Brannen 5d309d5724 Improve SimpleAliasRegistryTests
This commit improves SimpleAliasRegistryTests in the following ways.

- Some existing methods have been split up into smaller test methods
  which focus on a single use case.

- The use of Mockito mocks has been replaced by a hand-crafted
  StubStringValueResolver which ensures that existing aliases and names
  are not accidentally replaced by null thereby removing their removing
  there mappings inadvertently.

- Several test methods now include inline comments that document the
  current state of the aliasMap in order to clarify what is happening
  behind the scenes in the ConcurrentHashMap.

- Several test methods warn that the current expectations are based on
  ConcurrentHashMap iteration order!

- New @⁠ParameterizedTest which is currently @⁠Disabled but
  demonstrates that complex use cases involving placeholder replacement
  can be supported consistently -- regardless of the values of the
  aliases involved -- but only if alias registration order is honored.

Closes gh-31353
2024-01-14 14:22:02 +01:00
Arjen Poutsma 3452354a11 Ensure correct capacity in DefaultDataBuffer
Closes gh-31873
2024-01-09 10:33:46 +01:00
Juergen Hoeller bb1cdb6b48 Consistently expose parameter annotations from base classes as well
Closes gh-25788
2024-01-08 21:03:32 +01:00
Stéphane Nicoll 1f2d29ee08 Polish 2024-01-08 17:12:33 +01:00
Juergen Hoeller 419e34e571 Introduce getMostSpecificMethod variant on BridgeMethodResolver
This is able to resolve the original method even if no bridge method has been generated at the same class hierarchy level (a known difference between the Eclipse compiler and regular javac).

Closes gh-21843
2024-01-07 16:33:06 +01:00
Juergen Hoeller d6c84c43ec Polishing 2024-01-06 23:24:48 +01:00
Juergen Hoeller 70247c4a94 Refine exception handling for type not present versus access exception
Includes TypeVariable bypass for reflection-free annotation retrieval.
Includes info log message for annotation attribute retrieval failure.

Closes gh-27182
2024-01-06 23:02:59 +01:00
Juergen Hoeller 07097976ef Polishing 2024-01-05 10:08:57 +01:00
Stéphane Nicoll af2e13e211 Polish 2024-01-05 06:34:09 +01:00
Juergen Hoeller 174eae377f Upgrade to ASM master (including early support for Java 23 bytecode)
Closes gh-31929
2023-12-31 13:29:50 +01:00