Commit Graph

1710 Commits

Author SHA1 Message Date
Phillip Webb b91ccf038f Start migration annotation utility methods
Create internal variants of the existing `AnnotationUtils` and
`AnnotatedElementUtils` classes and migrate the existing classes to
use them.

The internal variants will be used to check that the same results are
given as we migrate the utils methods to use the new `MergedAnnotations`
API.

See gh-22562
2019-03-22 20:40:05 +01:00
Phillip Webb 4972d85ae0 Create a new API for handling merged annotations
Add new `MergedAnnotations` and `MergedAnnotation` interfaces that
attempt to provide a uniform way for dealing with merged annotations.

Specifically, the new API provides alternatives for the static methods
in `AnnotationUtils` and `AnnotatedElementUtils` and supports Spring's
comprehensive annotation attribute `@AliasFor` features. The interfaces
also open the possibility of the same API being exposed from the
`AnnotationMetadata` interface.

Additional utility classes for collecting, filtering and selecting
annotations have also been added.

Typical usage for the new API would be something like:

	MergedAnnotations.from(Example.class)
		.stream(MyAnnotation.class)
		.map(a -> a.getString("value"))
		.forEach(System.out::println);

Closes gh-21697
2019-03-22 20:40:05 +01:00
Phillip Webb fdacda8b01 Add AnnotationIntrospectionFailureTests
Add a new test class to help cover annotation introspection failure
handling. These tests were previously missing and are important to
ensure that annotation util code changes don't introduce regressions.

See gh-21697
2019-03-22 20:40:05 +01:00
Phillip Webb 8ef609a1b7 Add public variant getDeclaredMethods method
Add a public variant of `getDeclaredMethods` that defensively copies the
cached methods array. This is often more faster and more convenient
for users than calling `doWithLocalMethods`. We still retain most of the
benefits of the cache, namely fewer security manager calls and not as
many `Method` instances being created.

Closes gh-22580
2019-03-22 20:40:05 +01:00
Phillip Webb 9c92b21af8 Polishing 2019-03-22 20:40:05 +01:00
Rossen Stoyanchev 4a397f108a ResourceDecoder supports filename hint
Closes gh-22267
2019-03-19 17:50:06 -04:00
Sebastien Deleuze 1382220021 Add support for Deferred to ReactiveAdapterRegistry
See gh-19975
2019-03-15 18:22:19 +01:00
stsypanov 29f382b04e Simplify String concatenation 2019-03-14 17:24:33 +01:00
Juergen Hoeller 62c923711d Consistent use of empty array constants in ReflectionUtils
Closes gh-22567
2019-03-12 22:44:15 +01:00
Juergen Hoeller a7adafdb6a Larger initial size for ASM type descriptor StringBuilder
Closes gh-22565
2019-03-12 22:44:00 +01:00
Juergen Hoeller 40c62139ae Early resolution of unique factory methods in configuration classes
Includes consistent bean class resolution in the enhancement step as well as general reflection optimizations for user-declared methods.

Closes gh-22420
2019-03-12 17:17:24 +01:00
Сергей Цыпанов a35adc6ea6 Add missing break statements to stop looping when result is known
Closes gh-22573
2019-03-12 13:15:59 +01:00
Juergen Hoeller e3a9826e56 Bypass method traversal for annotation introspection if possible
The isCandidateClass mechanism is consistently used for a bypass check before method traversal attempts. While by default this is only bypassing standard java types, the same mechanism can be used with index metadata which indicates non-presence of certain annotations.

See gh-22420
2019-03-12 00:12:22 +01:00
Sam Brannen b09e6c8aaf Polishing 2019-03-09 16:53:09 +01:00
Tomasz Linkowski 8ddb1e7201 Fix a typo in @NonNullFields
Prior to this commit, `@NonNullFields` had a redundant `@see NonNullFields`
declaration instead of `@see NonNullApi` in its JavaDoc.

Closes gh-22553
2019-03-09 16:46:15 +01:00
Sam Brannen b109f140a7 Improve documentation for annotation filters with component scanning
Prior to this commit the documentation for annotation-based include and
exclude filters used with component scanning did not explicitly mention
the fact that annotations are considered a match if they are either
present or meta-present on candidate classes.

This commit improves the documentation in this regard.

See gh-22551
2019-03-09 16:30:30 +01:00
Juergen Hoeller c04eaf6b84 Merge branch '5.1.x' 2019-03-08 23:06:37 +01:00
Juergen Hoeller fe0c2d6b6e StringUtils.toStringArray/CollectionUtils.toIterator handle null input
Closes gh-22547
2019-03-08 22:40:18 +01:00
Juergen Hoeller f5248ff13f Upgrade to ASM 7.1
Closes gh-22503
2019-03-08 09:58:16 +01:00
Juergen Hoeller ac4c37d8e2 Merge branch '5.1.x' 2019-03-07 18:05:46 +01:00
Juergen Hoeller 6c87ef09c1 Polishing 2019-03-07 17:55:32 +01:00
stsypanov cb4d6f097c Use StringJoiner where possible to simplify String joining 2019-03-07 16:51:18 +01:00
Sam Brannen f087fd5a93 Report offending class in SpringFactoriesLoader in exception message
Prior to this commit, the exception message generated by
instantiateFactory() in SpringFactoriesLoader did not report the
offending class in the top-level exception message. The offending class
was in fact included in the message of the nested exception, but the
top-level exception message on its own was a bit misleading.

This commit improves the diagnostics for such failures by including the
offending class and the target factory type in the top-level exception
message.

Closes gh-22453
2019-03-06 16:44:41 +01:00
Konrad Kamiński 9302cb2f85 Support Kotlin suspending functions in MethodParameter
Before this commit, the return type for Kotlin suspending functions
(as returned by MethodParameter#getParameterType and
MethodParameter#getGenericReturnType methods) was incorrect.

This change leverages Kotlin reflection instead of Java one
to return the correct type.

Closes gh-21058
2019-03-06 10:14:34 +01:00
Rossen Stoyanchev 9e7f557b4a Updates for buffer management in RSocket
- Integration tests run with zero copy configuration.
- RSocketBufferLeakTests has been added.
- Updates in MessagingRSocket to ensure proper release

See gh-21987
2019-03-04 23:35:43 -05:00
Sam Brannen 70cf597484 Remove obsolete overview.html files 2019-03-04 14:07:48 +01:00
Brian Clozel 3ac1dddb9d Merge branch '5.1.x' 2019-03-04 13:58:41 +01:00
Andrew Tulloch 090aceb3ad Fix repeated calls to DataBuffer.write(CharSequence, Charset)
Prior to this commit, repeated calls to `DataBuffer.write(CharSequence,
Charset)` would not write the given chars to the expected position in
the original buffer.

This commit fixes that by writing to the `outBuffer.position()`, offset
by the current `DataBuffer.writePosition()`.

Fixes gh-22484
2019-03-04 13:37:06 +01:00
Juergen Hoeller a7db395d9b Merge branch '5.1.x' 2019-02-28 19:29:04 +01:00
Juergen Hoeller 5d8a34fee6 Only prefer JDK 9+ Lookup.defineClass API if ClassLoader matches
Closes gh-22416
2019-02-28 19:28:03 +01:00
Juergen Hoeller fc7948c96b Merge branch '5.1.x' 2019-02-27 17:34:46 +01:00
Juergen Hoeller e583da0725 Polishing 2019-02-27 17:26:53 +01:00
Sam Brannen 40da78e9df Polishing 2019-02-27 16:30:05 +01:00
Juergen Hoeller bc0317af3b Merge branch '5.1.x' 2019-02-25 17:57:49 +01:00
Juergen Hoeller 9eb7f7e294 Polishing 2019-02-25 17:36:37 +01:00
Sebastien Deleuze dc8fb8bc5e Use StringJoiner where possible to simplify String joining 2019-02-25 12:11:57 +01:00
Juergen Hoeller 6db75956b9 Merge branch '5.1.x' 2019-02-15 17:16:28 +01:00
Juergen Hoeller e307dd58db Polishing 2019-02-15 17:06:11 +01:00
stsypanov 5e29ea30a3 Use StringJoiner where possible to simplify String joining 2019-02-15 14:55:35 +01:00
stsypanov e7dc439f90 Simplify ConcurrentReferenceHashMap 2019-02-15 14:27:43 +01:00
stsypanov d2bfca7900 Extract duplicated code into a separate method 2019-02-15 14:26:44 +01:00
stsypanov 92053bb84e Some very simple improvements regarding ArrayList 2019-02-15 14:25:13 +01:00
Juergen Hoeller 5e0cd9fb60 Merge branch '5.1.x' 2019-02-14 13:39:58 +01:00
Juergen Hoeller ac0e5d8ec6 DefaultConversionService properly converts Object[] to int[]
Closes gh-22410
2019-02-14 13:38:29 +01:00
Juergen Hoeller 4e47006a17 Merge branch '5.1.x' 2019-02-12 09:09:19 +01:00
Juergen Hoeller 106a757098 Polishing 2019-02-12 09:07:58 +01:00
Juergen Hoeller 8637540678 Expose empty annotation array as empty AnnotationAttributes array
Closes gh-22405
2019-02-12 09:07:51 +01:00
Brian Clozel fb4a28f904 Polish
See gh-22340
2019-02-11 10:45:50 +01:00
Juergen Hoeller 783a7ca46b Merge branch '5.1.x' 2019-02-08 18:16:27 +01:00
Juergen Hoeller ba0c48b933 Polishing 2019-02-08 18:02:28 +01:00