Commit Graph

4160 Commits

Author SHA1 Message Date
Juergen Hoeller e9f9a7ae8e Merge branch '6.1.x'
# Conflicts:
#	framework-platform/framework-platform.gradle
2024-09-11 17:17:38 +02:00
Juergen Hoeller 54dbb9f52a Upgrade to Objenesis 3.4
Closes gh-33526
2024-09-11 17:15:37 +02:00
Patrick Strawderman 7827188e8e Avoid empty array allocations in AnnotationTypeMapping
Closes gh-33507
2024-09-11 09:49:39 +02:00
Patrick Strawderman 2b6639e587 Avoid storing duplicate empty array in MethodParameter field
Avoid storing duplicate empty arrays in the parameterAnnotations field of MethodParameter.

Closes gh-33496
2024-09-06 10:02:02 +02:00
Patrick Strawderman f88c314e83 Avoid empty array allocations in ResolvableType
Avoid allocating empty arrays in a few places in ResolvableType.

Closes gh-33473
2024-09-04 10:40:20 +02:00
Sam Brannen 717b972f88 Polish contribution
See gh-33452
2024-09-03 18:08:23 +02:00
Yanming Zhou 019c0b1d4e
Expand acronyms FQN and FQCN
Closes gh-33452
2024-09-03 17:30:27 +02:00
Johnny Lim 6e640f0800 Add Javadoc since for ReflectionHints.registerForInterfaces()
See gh-32824
Closed gh-33458
2024-09-02 16:21:35 +02:00
Juergen Hoeller 69d5587f53 Merge branch '6.1.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java
2024-08-31 12:04:29 +02:00
Juergen Hoeller 5d80d75051 Follow symlinks during root path traversal
Closes gh-33424
2024-08-31 12:00:14 +02:00
Sam Brannen 167cb5d494 Polishing 2024-08-29 17:02:08 +02:00
Sam Brannen ba774c6290 Restore behavior for ClassUtils.getInterfaceMethodIfPossible()
Commit 47f88e123f introduced support for invoking init/destroy/SpEL
methods via public types whenever possible. To achieve that,
getInterfaceMethodIfPossible() was modified so that it only returned
interface methods from public interfaces; however, we have learned that
third parties relied on the previous behavior which found any interface
method (even in non-public interfaces).

In light of the above, this commit partially reverts commit 47f88e123f
in order to reinstate getInterfaceMethodIfPossible() in non-deprecated
form with its previous behavior.

See gh-33216
2024-08-27 11:42:07 +02:00
Sam Brannen d2ea5b4448 Polish internal Javadoc 2024-08-23 11:24:22 +02:00
Sam Brannen 47f88e123f Invoke init/destroy/SpEL methods via public types whenever possible
Prior to this commit, when invoking init methods and destroy methods
for beans as well as methods within Spring Expression Language (SpEL)
expressions via reflection, we invoked them based on the "interface
method" returned from ClassUtils.getInterfaceMethodIfPossible(). That
works well for finding methods defined in an interface, but it does not
find public methods defined in a public superclass.

For example, in a SpEL expression it was previously impossible to
invoke toString() on a non-public type from a different module. This
could be seen when attempting to invoke toString() on an unmodifiable
list created by Collections.unmodifiableList(...). Doing so resulted in
an InaccessibleObjectException.

Although users can address that by adding an appropriate --add-opens
declaration, such as --add-opens java.base/java.util=ALL-UNNAMED, it is
better if applications do not have to add an --add-opens declaration
for such use cases in SpEL. The same applies to init methods and
destroy methods for beans.

This commit therefore introduces a new
getPubliclyAccessibleMethodIfPossible() method in ClassUtils which
serves as a replacement for getInterfaceMethodIfPossible().

This new method finds the first publicly accessible method in the
supplied method's type hierarchy that has a method signature equivalent
to the supplied method. If the supplied method is public and declared
in a public type, the supplied method will be returned. Otherwise, this
method recursively searches the class hierarchy and implemented
interfaces for an equivalent method that is public and declared in a
public type. If a publicly accessible equivalent method cannot be
found, the supplied method will be returned, indicating that no such
equivalent method exists.

All usage of getInterfaceMethodIfPossible() has been replaced with
getPubliclyAccessibleMethodIfPossible() in spring-beans and
spring-expression. In addition, getInterfaceMethodIfPossible() has been
marked as deprecated in favor of the new method.

As a bonus, the introduction of getPubliclyAccessibleMethodIfPossible()
allows us to delete a fair amount of obsolete code within the SpEL
infrastructure.

See gh-29857
Closes gh-33216
2024-08-22 14:35:21 +02:00
Sam Brannen cac623b3f4 Refer to the "Java Module System" instead of "Jigsaw" 2024-08-22 13:00:39 +02:00
Sébastien Deleuze a9a1798012 Merge branch '6.1.x' 2024-08-16 14:37:56 +02:00
Sébastien Deleuze 46c29b9175 Support Boolean property in BindingReflectionHintsRegistrar
Closes gh-33380
2024-08-16 14:37:12 +02:00
Sam Brannen d749d2949d Use new features from JUnit Jupiter 5.11
This commit primarily migrates to the new argumentSet() feature but also
applies additional polishing to our use of parameterized tests.

See gh-33395
2024-08-16 13:48:19 +02:00
Juergen Hoeller e1cf203295 Merge branch '6.1.x'
# Conflicts:
#	framework-platform/framework-platform.gradle
2024-08-13 19:05:20 +02:00
Juergen Hoeller d0bff584d7 Polishing 2024-08-13 18:51:02 +02:00
Sam Brannen f6110dda06 Polishing 2024-08-08 17:48:57 +03:00
Sam Brannen f4604cfab3 Merge branch '6.1.x' 2024-08-04 17:14:10 +03:00
Sam Brannen cb6a5baac5 Support conversion from primitive array to Object[] in ConversionService
Prior to this commit, the ConversionService failed to convert a primitive
array (such as int[]) to an Object[] due to an error in the logic in
ArrayToArrayConverter.

This commit addresses this by augmenting the "can bypass conversion"
check in ArrayToArrayConverter to ensure that the supplied source object
is an instance of the target type (i.e., that the source array can be
cast to the target type array without conversion).

Closes gh-33212
2024-08-04 17:13:56 +03:00
Stéphane Nicoll ec9d29ea8f Polish "Improve test coverage of StringUtils"
See gh-33298
2024-08-01 07:32:41 +02:00
zinzo a2cae4c8f4 Improve test coverage of StringUtils
This commit adds tests for `trimArrayElements()` and
`delimitedListToStringArray()` in StringUtils.

See gh-33298
2024-08-01 07:23:28 +02:00
Stéphane Nicoll b6fbbeccdc Polish "Resolved nested placeholder for CharSequence"
See gh-32876
2024-07-22 14:59:58 +02:00
Sam Brannen aa2829455b Expand test coverage for gh-14200 2024-07-13 17:26:26 +02:00
Sam Brannen 59b9404956 Specify nullability @⁠Contract for TypeDescriptor.array() 2024-07-12 18:02:26 +02:00
Sam Brannen 09d8e4458c Merge branch '6.1.x' 2024-07-12 17:37:51 +02:00
Sam Brannen ae5dd54115 Add @⁠Disabled tests for primitive varargs array to Object[] conversion 2024-07-12 17:36:54 +02:00
Juergen Hoeller d1f9e35b35 Merge branch '6.1.x' 2024-07-11 16:16:31 +02:00
Juergen Hoeller 2bfff7fc37 Retain original URL instance in case of custom URLStreamHandler
Closes gh-33199
2024-07-11 16:15:42 +02:00
Sébastien Deleuze 7617a01f60 Unwrap Kotlin inline value classes return values
The result returned by Kotlin reflective invocation of a function
returning an inline value class is wrapped, which makes sense
from Kotlin POV but from a JVM perspective the associated value
and type should be unwrapped to be consistent with what
would happen with a reflective invocation done by Java.

This commit unwraps such result.

Closes gh-33026
2024-07-10 18:38:37 +02:00
gregw 0a60c622cc Implement Eclipse Jetty core HTTP handler adapter
This provides an implementation of an HTTP Handler Adapter that is coded
directly to the Eclipse Jetty core API, bypassing any servlet
implementation.

This includes a Jetty implementation of the spring `WebSocketClient`
interface, `JettyWebSocketClient`, using an explicit dependency to the
jetty-websocket-api.

Closes gh-32097

Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Arjen Poutsma <arjen.poutsma@broadcom.com>
2024-07-08 18:36:46 +02:00
Stéphane Nicoll 93587da394 Introduce ReflectiveScan
This commit allows `@Reflective` to be used on arbitrary types, not
only Spring beans. This makes the feature much more powerful as
components can be tagged directly.

Scanning happens during AOT processing (typically at build-time) when
`@ReflectiveScan` is used. Types do not need to have a particular
annotation, and types that can't be loaded are ignored.

This commit also exposes the infrastructure that does the scanning so
that custom code can do the scanning in an AOT contribution if they
don't want to rely on the annotation.

Closes gh-33132
2024-07-08 11:11:48 +02:00
Stéphane Nicoll f4607da45f Introduce RegisterReflection
This commit introduces a declarative way of registering reflection
information for arbitrary types. Types can be specified as a class,
a class name, or by annotating the type itself.

This existing RegisterReflectionForBinding becomes a specialized
version of the new annotation, registering the necessary hints for
data binding.

Closes gh-29194
2024-07-04 17:49:41 +02:00
Stéphane Nicoll 1ea4eb147a Polish 2024-07-03 10:04:51 +02:00
Stéphane Nicoll 99e8978a91 Restore binary backward compatibility for GeneratedFiles
See gh-31331
2024-07-03 09:57:22 +02:00
Sam Brannen 932ce04541 Stop referring to old Spring versions in Javadoc 2024-07-01 17:50:52 +02:00
Stephane Nicoll 0ea7af7465 Polish
See gh-31331
2024-06-24 18:07:59 +02:00
Sébastien Deleuze 8ef74dfdad 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.

IntelliJ IDEA 2024.1.2+ is required to interpret correctly the related
annotations.

Closes gh-27183
2024-06-24 14:56:07 +02:00
Juergen Hoeller 0a0f4c7460 Accept file separator difference in exception message (for Windows compatibility) 2024-06-24 12:28:43 +02:00
Juergen Hoeller d9a2e0b731 Merge branch '6.1.x' 2024-06-24 12:27:23 +02:00
Juergen Hoeller 4e2fb308f6 Document contentLength() behavior for InputStreamResource and custom subclasses
Closes gh-33089
2024-06-24 12:10:35 +02:00
Brian Clozel f9af5d400d Use custom path separator for pattern comparisons
As pointed out in gh-33085, the `AntPatternComparator` hardcodes the "/"
separator when checking for "catch all" patterns like "/**".
This commit ensures that the custom path separator is used for those
checks, in order to guarantee consistent comparator results.

See gh-33085
2024-06-24 11:37:24 +02:00
Brian Clozel 6d1f117103 Polishing contribution
Closes gh-33085
2024-06-24 11:37:16 +02:00
tafjwr 83fcdfba64 Fix AntPathMatcher URI template variable extractor
See gh-33085
2024-06-24 11:37:09 +02:00
Stephane Nicoll 2650da2b53 Provide more control over registration of GeneratedFiles
This commit provides an advanced handling of generated files that
provides more control over files registration. The callback provides
a FileHandler that can determine if the file already exists and its
content. The caller can then chose to override the content or leave it
as it is.

Closes gh-31331
2024-06-22 18:52:33 +02:00
Stéphane Nicoll 5cf8978d22 Restore proper code generation for types with nested generics
This commit aligns code generation to recent improvement in the core
container regarding type detection. Now that nested types are properly
resolved, our code generation that uses hasResolvableGenerics() is
taking the wrong decision if only a nested type has an unresolved
generics. Previously, this was hidden by the fact that the core
container would not resolve them recursively.

A new hasResolvableGenerics() method allows to verify that at least
one direct generic type is resolved. This restore our intent of checking
at the first level only and let recursive invocations figure out if they
have to write the raw type or the type with generics.

Closes gh-33069
2024-06-19 17:48:39 +02:00
Juergen Hoeller 6d5c312027 Merge branch '6.1.x' 2024-06-17 18:44:50 +02:00
Juergen Hoeller 2c3c3831c1 Consistently ignore bridge method on generated subclass for visibility purposes
Closes gh-33030
2024-06-17 18:42:20 +02:00
Stéphane Nicoll 720b7c1dac Merge branch '6.1.x' 2024-06-11 06:53:22 +02:00
Stéphane Nicoll 6b7f0bd4b6 Fix typo 2024-06-11 06:47:42 +02:00
Sébastien Deleuze 68e6b152ef Merge branch '6.1.x' 2024-06-10 22:46:03 +02:00
Sébastien Deleuze c97a895f09 Add support for double backslashes to StringUtils#cleanPath
Closes gh-32962
2024-06-10 22:25:31 +02:00
Sam Brannen 9e1ef83669 Avoid issues with system line separator in tests
See f10caf6aa6
2024-06-05 12:36:58 +02:00
Sébastien Deleuze f31113e325 Merge branch '6.1.x' 2024-06-03 18:58:33 +02:00
Sébastien Deleuze 43409b00d0 Refine KotlinDetector.isKotlinType documentation
This commit documents changes in lambda detection
as of Kotlin 2.0.

Closes gh-32905
2024-06-03 18:58:13 +02:00
Sébastien Deleuze eefdf42e7e Merge branch '6.1.x' 2024-06-03 18:28:17 +02:00
Sébastien Deleuze d55abc6cf9 Fix RegisterReflectionForBinding Javadoc
Closes gh-32947
2024-06-03 18:26:24 +02:00
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