Commit Graph

2665 Commits

Author SHA1 Message Date
Juergen Hoeller
e16dd5f3e2 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

(cherry picked from commit 70247c4a94)
2024-01-06 23:20:39 +01:00
Juergen Hoeller
b2bdc7de30 Polishing 2023-12-30 15:51:05 +01:00
Sam Brannen
8f2bb4973d Scan annotations on method in interface hierarchy only once
Prior to this commit, the AnnotationsScanner used in the
MergedAnnotations infrastructure found duplicate annotations on methods
within multi-level interface hierarchies.

This commit addresses this issue by scanning methods at a given level
in the interface hierarchy using ReflectionUtils#getDeclaredMethods
instead of Class#getMethods, since the latter includes public methods
declared in super-interfaces which will anyway be scanned when
processing super-interfaces recursively.

Closes gh-31803

(cherry picked from commit 75da9c3c47)
(cherry picked from commit 1e742aae34)
2023-12-13 10:24:15 +01:00
Sam Brannen
a45154c875 Polish MergedAnnotation tests
(cherry picked from commit 952223dcf9)
(cherry picked from commit 20dd585c93)
2023-12-13 10:24:15 +01:00
Juergen Hoeller
0ecbeef01d Consider generics in equals method (for ConversionService caching)
Closes gh-31672

(cherry picked from commit 710373d286)
2023-11-24 23:40:04 +01:00
Sam Brannen
c489234cc2 Polish contribution
See gh-31598
See gh-31603

(cherry picked from commit e71117dcdf)
2023-11-14 15:31:32 +01:00
Jason
af593588d3 Avoid duplicate resources in PathMatchingResourcePatternResolver on Windows
This commit updates PathMatchingResourcePatternResolver to avoid
returning duplicate resources on MS Windows when searching using the
`classpath*:` prefix and a wildcard pattern that matches resources
which are directly present in a JAR as well as present via classpath
manifest entries.

See gh-31598
Closes gh-31603

(cherry picked from commit d5874ab99e)
2023-11-14 15:31:11 +01:00
Juergen Hoeller
de0cb53394 Polishing
(cherry picked from commit 925fa0272b)
2023-10-24 23:32:17 +02:00
Juergen Hoeller
2dc4fe0857 BeanCopier sets name prefix for public classes as well
Includes consistent formatting of Spring-patched files.

Closes gh-28699

(cherry picked from commit 7a60e2024b)
2023-10-15 16:25:40 +02:00
Juergen Hoeller
2ec32a4e2f Polishing 2023-09-29 15:39:11 +02:00
Sam Brannen
d62f17864c Test status quo for zero capacity behavior in ConcurrentLruCache
See gh-31317
2023-09-27 12:57:08 +02:00
Juergen Hoeller
39c225c813 AnnotationUtils.clearCache() includes all annotation caches
Closes gh-31170

(cherry picked from commit 78fce80c43)
2023-09-11 17:49:56 +02:00
Sam Brannen
ddcae04ad5 Do not invoke [Map|Collection].isEmpty() in nullSafeConciseToString()
gh-30811 introduced explicit support for collections and maps in
ObjectUtils.nullSafeConciseToString() by invoking isEmpty() on a Map or
Collection to determine which concise string representation should be
used. However, this caused a regression in which an exception was
thrown if the Map or Collection was a proxy generated by
AbstractFactoryBean to support <util:set />, <util:list />, and
<util:map /> in XML configuration.

This commit addresses this set of regressions by always returning
"[...]" or "{...}" for a Collection or Map, respectively, disregarding
whether the map is empty or not.

Closes gh-31156
2023-09-08 16:21:39 +02:00
Juergen Hoeller
994bbec0c3 Polishing 2023-08-23 18:57:17 +02:00
Sébastien Deleuze
a4fc7d3c11 Optimize ClassUtils#getMostSpecificMethod
This commit optimizes ClassUtils#getMostSpecificMethod which is
a method frequently invoked in typical Spring applications.

It refines ClassUtils#isOverridable by considering static and
final modifiers as non overridable and optimizes its implementation.

Closes gh-31100
2023-08-23 18:16:49 +02:00
Sam Brannen
88c3a788f3 Update copyright headers 2023-08-21 15:12:54 +02:00
Juergen Hoeller
493f75e892 Optimize whitespace checks in StringUtils (as far as possible on JDK 8)
Closes gh-31067
2023-08-18 11:40:19 +02:00
Juergen Hoeller
b9be40ccd2 Add registerReactiveTypeOverride method to ReactiveAdapterRegistry
Closes gh-31047

(cherry picked from commit 389238f622)
2023-08-14 15:18:56 +02:00
Juergen Hoeller
9d7154901f Polishing
(cherry picked from commit 6e5af9dccb)
2023-08-06 14:50:24 +02:00
Juergen Hoeller
24893d038f Polishing 2023-08-04 10:35:51 +02:00
Juergen Hoeller
c5aa7830bc Polishing
(cherry picked from commit abbea39855)
2023-07-27 21:58:22 +02:00
Juergen Hoeller
a7b7466274 Polishing 2023-07-19 01:17:25 +02:00
Juergen Hoeller
b387d9bf10 MethodIntrospector handles overriding bridge method correctly
Closes gh-30906

(cherry picked from commit 616f728afa)
2023-07-18 13:27:15 +02:00
Juergen Hoeller
ef65429823 Polishing
(cherry picked from commit 3a278cc66d)
2023-07-15 14:38:30 +02:00
Juergen Hoeller
0b4b313bae Cache DependencyDescriptor per autowired constructor argument
Aligned with shortcut handling in AutowiredAnnotationBeanPostProcessor.
Includes minor MethodInvoker optimization for pre-resolved targetClass.

Closes gh-30883

(cherry picked from commit 6183f06846)
2023-07-15 14:38:24 +02:00
Juergen Hoeller
355fa258bd Polishing 2023-07-14 14:52:15 +02:00
Juergen Hoeller
53319381d0 Polishing
(cherry picked from commit c873a597c7)
2023-07-12 19:25:26 +02:00
Juergen Hoeller
ac94d2bd54 Polishing
(cherry picked from commit f19433f2d8)
2023-07-11 18:40:40 +02:00
Juergen Hoeller
c1bf09952b Improve diagnostics for LinkageError in case of ClassLoader mismatch
Closes gh-25940
2023-07-11 18:36:12 +02:00
Juergen Hoeller
14a7983eef Tolerate isCandidateClass call with null as annotation type
Closes gh-30842

(cherry picked from commit a102cd5f32)
2023-07-09 17:05:54 +02:00
Sam Brannen
03f1fabbdb Improve assertions in DefaultConversionServiceTests
Specifically, we now check the actual type of a converted collection in
various assertions to ensure that converters adhere to their contracts.
2023-07-06 13:11:35 +02:00
Sam Brannen
2ada2b77f6 Update Javadoc for ObjectUtils.nullSafeConciseToString()
See gh-30811
2023-07-06 12:29:46 +02:00
Juergen Hoeller
d5380b3070 Expand tests for array to Collection/Set/List interface
See gh-28048
2023-07-05 21:12:36 +02:00
Sam Brannen
a3907a64e5 Support arrays, collections, & maps in ObjectUtils.nullSafeConciseToString()
Prior to this commit, there was no explicit support for arrays,
collections, and maps in nullSafeConciseToString(). This lead to string
representations such as the following, regardless of whether the array,
collection, or map was empty.

- char[]@1623b78d
- java.util.ImmutableCollections$List12@74fe5c40
- java.util.ImmutableCollections$MapN@10e31a9a

This commit introduces explicit support for arrays, collections, and
maps in nullSafeConciseToString(), which results in the following
empty/non-empty string representations.

- array: {} / {...}
- collection: [] / [...]
- map: {} / {...}

The reason a string representation of an array uses "{}" instead of
"[]" (like in Arrays.toString(...)) is that
ObjectUtils.nullSafeToString(<array>) already follows that convention,
and the implementation of nullSafeConciseToString() aligns with that
for the sake of consistency.

Closes gh-30811
2023-07-05 17:15:15 +02:00
Juergen Hoeller
5d4c2846d9 Polishing 2023-07-04 16:43:29 +02:00
Juergen Hoeller
a3daee6ad8 Make File/Path tests pass on Windows
See gh-30806
2023-07-04 16:38:10 +02:00
Sam Brannen
c057da23ec Extend supported types in ObjectUtils.nullSafeConciseToString()
This commit extends the list of explicitly supported types in
ObjectUtils.nullSafeConciseToString() with the following.

- Optional
- File
- Path
- InetAddress
- Charset
- Currency
- TimeZone
- ZoneId
- Pattern

Closes gh-30806
2023-07-04 15:01:35 +02:00
Sam Brannen
a7f07328ab Add tests for status quo in ObjectUtils.nullSafeConciseToString() 2023-07-04 14:57:57 +02:00
Juergen Hoeller
e440eb8365 Consistently handle invocation exceptions in TypeProxyInvocationHandler
Closes gh-30764

(cherry picked from commit 3cb746c358)
2023-06-28 15:48:41 +02:00
Sam Brannen
2e51aa250e Update copyright headers 2023-06-22 14:54:43 +02:00
Juergen Hoeller
d3df45d8fe Avoid ResolvableType creation for interface/superclass check
See gh-30713

(cherry picked from commit 1dfe737d0e)
2023-06-21 17:46:59 +02:00
Juergen Hoeller
5375f62dc1 Cache hasUnresolvableGenerics result for repeated checks
Closes gh-30713

(cherry picked from commit 93218a06ba)
2023-06-21 13:24:42 +02:00
Juergen Hoeller
99ae6e70bb Declare ClassLoader for DeserializingConverter constructor as nullable
Closes gh-30670

(cherry picked from commit b9221656cc)
2023-06-14 22:34:28 +02:00
Juergen Hoeller
c2cc55eacc Consider UUID as simple value type with concise toString output
Closes gh-30661

(cherry picked from commit 927d27b121)
2023-06-14 10:47:54 +02:00
Juergen Hoeller
46d171a8fd Restore creation of plain HashSet/HashMap for direct HashSet/HashMap type
Closes gh-30596

(cherry picked from commit cdc4497664)
2023-06-05 14:03:15 +02:00
Juergen Hoeller
9decbf2158 Polishing 2023-06-03 00:01:18 +02:00
Stephane Nicoll
4e696db922 Update copyright year of changed file
See gh-30554
2023-05-30 09:18:06 +02:00
Stefano Cordio
0adad10595 Fix FileSystemUtils::deleteRecursively Javadoc
See gh-30554
2023-05-30 09:17:54 +02:00
Juergen Hoeller
0211016957 Consistent support for MultiValueMap and common Map implementations
Closes gh-30440
2023-05-08 12:13:44 +02:00
Sam Brannen
08fe123930 Introduce Environment.matchesProfiles() for profile expressions
Environment.acceptsProfiles(String...) was deprecated in 5.1 in
conjunction with gh-17063 which introduced a new
acceptsProfiles(Profiles) method to replace it. The deprecated method
only supports OR semantics; whereas, the new method supports profile
expressions. Thus, the goal was to encourage people to use the more
powerful profile expressions instead of the limited OR support with
profile names.

However, there are use cases where it is difficult (if not impossible)
to provide a Profiles instance, and there are use cases where it is
simply preferable to provide profile expressions directly as strings.

To address these issues, this commit introduces a new matchesProfiles()
method in Environment that accepts a var-args list of profile
expressions.

See gh-30206
Closes gh-30226
2023-04-25 19:19:22 +02:00