Commit Graph

974 Commits

Author SHA1 Message Date
Sébastien Deleuze
33fcba55d1 Disable KotlinPropertyResolverExtensionsTests for now
Those tests produce intermittent build errors.
2020-10-13 16:19:01 +02:00
Rossen Stoyanchev
b9f7b0d955 Upgrade to Reactor 2020.0-RC2
See gh-25884
2020-10-12 14:26:51 +01:00
Sam Brannen
a6bede22c1 Polish contribution
See gh-23379
2020-09-29 14:25:04 +02:00
Josh Cummings
a0c00362c3 Introduce Converter.andThen(...)
Closes gh-23379
2020-09-29 14:04:57 +02:00
Brian Clozel
e33e7d7681 Remove TestGroup.PERFORMANCE
Now that there's a new JMH infrastructure for benchmarks and that
performance tests have been rewritten to use it, we should remove the
`PERFORMANCE` `TestGroup` to avoid introducing such tests in the future.

Closes gh-24830
2020-09-25 13:43:38 +02:00
Brian Clozel
61d893257e Rewrite "performance" test to JMH benchmarks
This commit rewrites the remaining "fastEnough" performance tests into
proper JMH benchmarks.

See gh-24830
2020-09-25 13:43:38 +02:00
Brian Clozel
f7a014d7dc Improve MIME type subtype suffix handling
Prior to this commit, the subtype suffix of a MIME type (see RFC 6839)
was not properly taken into account when checking compatibility between
MIME types.

For example, `"application/*"` was not considered as compatible with
`"application/vnd.io.spring+json"`.

This commit adds a new `MimeType#getSubtypeSuffix()` method to easily
extract the subtype suffix information. This method is then reused in
the `isCompatibleWith` implementation to better handle these cases.

Fixes gh-25350
2020-09-08 14:46:48 +02:00
Сергей Цыпанов
1f3e52d932 gh-25650 Replace remaining usage of LinkedList with ArrayList in tests 2020-08-31 14:33:14 +02:00
Sam Brannen
0b57368d5f Merge branch '5.2.x' 2020-08-08 12:23:45 +02:00
Sam Brannen
e25e690ad4 Assert preconditions for MergedAnnotations.from() factory methods
Prior to this commit, if null values were supplied for the
RepeatableContainers or AnnotationFilter arguments to `from()` factory
methods in MergedAnnotations, certain operations would eventually
result in a NullPointerException. This is to be expected; however, the
NullPointerException is often swallowed and only logged at INFO level
with an exception message similar to the following.

> Failed to introspect annotations on org.example.MyClass: NullPointerException

In such cases, the INFO log message is not helpful in diagnosing the
problem. Furthermore, since the exception is swallowed, the desired
operation (e.g., MergedAnnotations.stream(...)) simply returns no
results.

This commit improves the user experience by eagerly asserting non-null
preconditions for required arguments in MergedAnnotations.from()
factory methods.

Closes gh-25568
2020-08-08 12:21:15 +02:00
Sam Brannen
f28918e91d Merge branch '5.2.x' 2020-07-30 13:38:32 +02:00
Sam Brannen
7dbf42e858 Polish contribution
See gh-25483
2020-07-29 20:16:21 +02:00
yilianhuaixiao
83a95832e6 Filter repeatable annotations in AnnotationTypeMappings
Prior to this commit, AnnotationTypeMappings did not filter repeatable
annotations with the supplied annotation filter.

Closes gh-25483
2020-07-29 17:11:24 +02:00
Sam Brannen
b841e8560c Polish MergedAnnotation API internals 2020-07-29 17:08:58 +02:00
Sam Brannen
8a394c2b07 Merge branch '5.2.x' 2020-07-28 10:00:21 +02:00
Sam Brannen
2b3fdfabb2 Remove unused class filtering support in AnnotationScanner
PR gh-25429 brought it to our attention that there was a bug in
AnnotationScanner when using a non-null class filter that filtered out
classes; however, it turns out that there is no production code that
utilizes the package-private class filtering support.

This commit therefore removes all class filtering support from
AnnotationScanner since that functionality is effectively unused.

Closes gh-25477
2020-07-28 09:58:14 +02:00
Sam Brannen
a03f894a14 Merge branch '5.2.x' 2020-07-25 15:48:53 +02:00
Sam Brannen
5442d8779a Polish contribution
See gh-25429
2020-07-25 15:24:36 +02:00
yilianhuaixiao
650cbeee14 Avoid infinite loop in AnnotationScanner
Prior to this commit, scanning for annotations resulted in an infinite
loop when using the INHERITED_ANNOTATIONS search strategy and a class
filter that filters out visited classes.

This commit avoids an infinite loop in AnnotationsScanner's
processClassInheritedAnnotations(...) method by skipping the current
level of the class hierarchy when the current source class has been
filtered out.

Closes gh-25429
2020-07-25 15:23:21 +02:00
Sam Brannen
471577a11b Polish contribution
See gh-25454
2020-07-22 11:35:31 +02:00
XenoAmess
523d2f88be Use List.sort instead of Collection.sort in tests
Closes gh-25454
2020-07-22 11:32:50 +02:00
XenoAmess
cd12583e13 Use Integer.parseInt instead of Integer.valueOf for primitive int
Closes gh-25456
2020-07-22 10:54:32 +02:00
XenoAmess
c7f44ff671 Fix links in Javadoc
Closes gh-25448
2020-07-22 10:24:55 +02:00
Sam Brannen
8e02d2706e Merge branch '5.2.x' 2020-07-07 14:18:56 +02:00
Sam Brannen
2c9e794676 Make Profiles created via Profiles.of() comparable
Prior to this commit, a Profiles instance created via Profiles.of() was
not considered equivalent to another Profiles instance created via
Profiles.of() with the exact same expressions. This makes it difficult
to mock invocations of Environment#acceptsProfiles(Profiles) -- for
example, when using a mocking library such as Mockito.

This commit makes Profiles instances created via Profiles.of()
"comparable" by implementing equals() and hashCode() in ParsedProfiles.

Note, however, that equivalence is only guaranteed if the exact same
profile expression strings are supplied to Profiles.of(). In other
words, Profiles.of("A & B", "C | D") is equivalent to
Profiles.of("A & B", "C | D") and Profiles.of("C | D", "A & B"), but
Profiles.of("X & Y") is not equivalent to Profiles.of("X&Y") or
Profiles.of("Y & X").

Closes gh-25340
2020-07-07 14:17:36 +02:00
Rossen Stoyanchev
b16f6fa456 Shared static instance of DefaultDataBufferFactory 2020-06-24 16:12:56 +01:00
Sam Brannen
ab0e651547 Polish SerializationTestUtils, clean up warnings, etc. 2020-06-20 18:17:03 +02:00
Sam Brannen
8099fc8178 Use try-with-resources language construct where feasible
Closes gh-2063

Co-authored-by: igor-suhorukov <igor.suhorukov@gmail.com>
2020-06-16 22:57:45 +02:00
Roland Weisleder
f9cca5d9d6 Add tests for Assert.noNullElements(Collection, ...)
Commit 4000b244ff introduced new variants for noNullElements in
org.springframework.util.Assert.

This commit adds the corresponding tests to AssertTests.

Closes gh-25239
2020-06-12 09:37:25 +02:00
Sam Brannen
bc4945d677 Ensure non-null condition comes 1st in ternary operator
See gh-25232
2020-06-11 15:11:48 +02:00
GardenLee
e866fac8e7 Wrap ternary operator within parentheses as outlined in Code Style
Closes gh-25232
2020-06-11 15:11:48 +02:00
Brian Clozel
212bb7fef6 Add GenericConversionService JMH benchmark
This commit removes some of the deprecated "PERFORMANCE" tests and turns
them into JMH benchmarks.

See gh-24830
2020-05-15 22:46:05 +02:00
Brian Clozel
567265123b Avoid using regex matching for static patterns
Prior to this commit (and the previous one), the `AntPathStringMatcher`
(inner class of `AntPathmatcher`) would compile `Pattern` instances and
use regex matching even for static patterns such as `"/home"`.

This change introduces a shortcut in the string matcher algorithm to
skip the `Pattern` creation and uses `String` equality instead.
Static patterns are quite common in applications and this change can
bring performance improvements, depending on the mix of patterns
configured in the web application.

In benchmarks (added with this commit), we're seeing +20% throughput
and -40% allocation. This of course can vary depending on the number of
static patterns configured in the application.

Closes gh-24887
2020-05-15 17:07:58 +02:00
Vlad Kisel
9bfe410a0c Avoid using regex for URL matching when possible
See gh-24887
2020-05-15 17:06:58 +02:00
Rossen Stoyanchev
7f59381c7d Add support for RxJava 3
Closes gh-24170
2020-05-11 08:48:48 +01:00
Sam Brannen
12e05280ad Upgrade to AssertJ 3.16 2020-05-06 15:22:23 +02:00
Rossen Stoyanchev
a7c736915a Polishing and completing contribution
See gh-24866
2020-05-05 18:20:45 +01:00
Vlad Kisel
3543e47841 Add ByteBufEncoder and ByteBufDecoder
See gh-24866
2020-05-05 18:20:45 +01:00
Rossen Stoyanchev
153690e717 Merge branch '5.2.x' 2020-05-04 10:55:25 +01:00
Rossen Stoyanchev
c2cce0c547 Add isDeferred to ReactiveTypeDescriptor
Closes gh-24995
2020-05-01 15:39:52 +01:00
Sam Brannen
859953fe81 Use same default ClassLoader in SpringFactoriesLoader
Prior to this commit, the loadFactoryNames() and loadFactories() methods
in SpringFactoriesLoader effectively used a different default
ClassLoader.

This commit ensures that the ClassLoader for SpringFactoriesLoader.class
is now consistently used as the default ClassLoader.

Closes gh-24992
2020-04-29 14:46:02 +02:00
Sam Brannen
4e32615b22 Filter out duplicates in SpringFactoriesLoader
Prior to this commit, SpringFactoriesLoader discovered all registered
factory implementations for a given factory type even if duplicates
were registered within a single META-INF/spring.factories file or in
multiple such files in the classpath.

This commit updates the internals of SpringFactoriesLoader so that
duplicate registrations are ignored, thereby aligning with the
well-known semantics for java.util.ServiceLoader in this regard.

Closes gh-24985
2020-04-28 16:44:18 +02:00
Sam Brannen
afc398333e Polishing 2020-04-28 16:34:58 +02:00
Sam Brannen
db45b80b1f Suppress warnings for deprecated AnnotationFilter.NONE enum constant
See gh-24932
2020-04-26 13:58:31 +02:00
Sam Brannen
8265db0ae1 Avoid synthesizing annotations unnecessarily
Commit 31fa1569c5 introduced initial support for avoiding unnecessary
annotation synthesis in the MergedAnnotation API; however, it only
avoided synthesis for annotations that do not declare any attributes.

This commit reworks this support to avoid unnecessary annotation
synthesis for annotations that declare attributes.

Specifically, this commit introduces a new `isSynthesizable()` method
in AnnotationTypeMapping that allows the "synthesizable" flag to be
computed once and cached along with the other metadata already cached
in AnnotationTypeMapping instances. TypeMappedAnnotation now delegates
to this new method when determining whether it should synthesize an
annotation.

Closes gh-24861
2020-04-23 19:09:30 +02:00
Sam Brannen
a9cc7b3edc Improve tests for synthesized array of annotations 2020-04-22 15:17:33 +02:00
Sam Brannen
31fa1569c5 Avoid synthesizing annotations unnecessarily
Prior to Spring Framework 5.2, some of our annotation utilities would
not synthesize an annotation if it was already synthesized or not
synthesizable (i.e., did not declare local aliases via @AliasFor and
did not declare attributes that could override attributes in the
meta-annotation hierarchy above the given annotation); however, we lost
most of this functionality with the introduction of the new
MergedAnnotations API.

This commit revises the implementation of createSynthesized() in
TypeMappedAnnotation so that, for invocations of
MergedAnnotation.synthesize() and indirectly for invocations of
AnnotatedElementUtils.findMergedAnnotation(), etc.:

1. An annotation that was previously synthesized will not be
   synthesized again.

2. An annotation that is not "synthesizable" will not be synthesized.

For both of the above use cases, the original annotation is now
returned from createSynthesized().

Closes gh-24861
2020-04-21 13:31:06 +02:00
Sam Brannen
376434eb75 Polishing 2020-04-19 19:17:02 +02:00
Sam Brannen
f42955c31b Polishing 2020-04-19 17:49:08 +02:00
Sam Brannen
3dadcaeb2d Polishing 2020-04-17 19:07:49 +02:00