Commit Graph

2357 Commits

Author SHA1 Message Date
Juergen Hoeller
04df9b8f49 Efficient checks for empty strings and single character matches
Closes gh-25552
Closes gh-25553
2020-08-25 16:17:12 +02:00
Rossen Stoyanchev
7758ba3c7e Refactor MonoToListenableFutureAdapter
Closes gh-25561
2020-08-14 15:18:39 +01:00
Sam Brannen
c558391e2c Declare interfaces as @FunctionalInterface where feasible
This commit declares each of the following public interfaces as a
@FunctionalInterface.

- org.springframework.context.ApplicationContextInitializer
- org.springframework.test.web.servlet.DispatcherServletCustomizer
- org.springframework.validation.MessageCodeFormatter
- org.springframework.util.IdGenerator
- org.springframework.beans.factory.config.YamlProcessor.MatchCallback
- org.springframework.beans.factory.config.YamlProcessor.DocumentMatcher

Closes gh-25580
2020-08-11 17:01:03 +02:00
Sam Brannen
596936f18c Polishing 2020-08-11 16:42:18 +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
a614abe17b Polish Javadoc for MergedAnnotations 2020-08-08 11:59:24 +02:00
Brian Clozel
617ec359bd Update after MonoProcessor deprecation in Reactor
This commit adapts the usage of `MonoProcessor` after deprecations
introduced in reactor/reactor-core#1053
2020-08-07 18:59:21 +02:00
Juergen Hoeller
f4c0ceb1cc Merge branch '5.2.x'
# Conflicts:
#	build.gradle
#	spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java
#	spring-web/src/main/java/org/springframework/web/bind/support/WebRequestDataBinder.java
#	spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExecutionChain.java
#	spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java
2020-08-07 13:15:36 +02:00
Juergen Hoeller
8dd285f877 Polishing 2020-08-07 13:02:43 +02:00
Juergen Hoeller
96a4e1150e Avoid unnecessary computation of cleaned URL
Closes gh-25531
2020-08-07 12:59:41 +02:00
Sam Brannen
c17f2047f6 Merge branch '5.2.x' 2020-08-03 13:44:39 +02:00
Sam Brannen
91d1383e93 Use Spliterators.emptySpliterator() in TypeMappedAnnotations
For greater clarity, this commit invokes Spliterators.emptySpliterator()
directly instead of going through java.util.Collections.EmptyList.
2020-08-03 13:44:02 +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
Brian Clozel
be801fc5fc Polish
See gh-24878
2020-07-28 14:48:25 +02:00
Juergen Hoeller
adce6593af Move metrics package to org.springframework.core
See gh-24878
2020-07-28 11:28:10 +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
Arjen Poutsma
cf8c36adf3 Javadoc
Add Javadoc note explaining that StringUtils.cleanPath should not be
depended on in security context.
2020-07-23 17:43:20 +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
XenoAmess
e71f702bb9 Use static private instead of private static for method declarations
Closes gh-25452
2020-07-21 18:26:28 +02:00
Juergen Hoeller
198d64d539 Merge branch '5.2.x'
# Conflicts:
#	build.gradle
2020-07-17 17:52:08 +02:00
Juergen Hoeller
01bab89dba Consistently use PropertySource.getName() for comparison
Includes synchronization for mutators on MutablePropertySources.

Closes gh-25369
2020-07-17 17:45:58 +02:00
May
490bdd11a5 Use Math.min() in ExponentialBackOff
Use Math.min() instead of doing it manually in ExponentialBackOff.

Closes gh-25381
2020-07-13 11:53:30 +02:00
Juergen Hoeller
a1bab14140 Upgrade to ASM 9.0 beta
Closes gh-24872
2020-07-07 16:17:58 +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
Sam Brannen
362e228142 Merge branch '5.2.x' 2020-07-03 12:04:34 +02:00
Sam Brannen
35582ded0e Use System.nanoTime() for Random seed in SocketUtils
Prior to this commit, SocketUtils used System.currentTimeMillis() for
the seed for the java.util.Random instance used internally. The use of
the milliseconds value returned by currentTimeMillis() can lead to
collisions for randomly selected free ports for tests executing in
parallel on the same computer.

This commit therefore switches to System.nanoTime() for the Random seed
used in SocketUtils in an attempt to avoid such collisions for tests
executing in parallel in different JVMs on the same computer.

Closes gh-25321
2020-07-03 12:04:02 +02:00
Rossen Stoyanchev
3aaff40e2e Replace explicit use of PooledDataBuffer.release() 2020-07-01 08:07:50 +01:00
Rossen Stoyanchev
b16f6fa456 Shared static instance of DefaultDataBufferFactory 2020-06-24 16:12:56 +01:00
Juergen Hoeller
56c661829b Avoid package cycle through dedicated ResourcePropertiesPersister
See gh-25151
2020-06-23 16:54:55 +02:00
Rossen Stoyanchev
f0b8e638ad Avoid dependency on netty-common in DataBufferUtils
See: gh-22594
2020-06-23 14:20:24 +01:00
Juergen Hoeller
9e12a20324 Polishing 2020-06-23 11:35:22 +02:00
izeye
a678db3888 Polish
Closes gh-880
2020-06-23 09:51:45 +02:00
Sam Brannen
ab0e651547 Polish SerializationTestUtils, clean up warnings, etc. 2020-06-20 18:17:03 +02:00
Sébastien Deleuze
63dff520e6 Disable and remove unsupported features from native images
This commit removes load time weaving, CGLIB and Objenesis support
from native images.

GraalDetector has been removed for now because of
https://github.com/oracle/graal/issues/2594. It should be reintroduced
when this bug will be fixed with NativeImageDetector class name.

Closes gh-25179
2020-06-20 17:05:13 +02:00
Rossen Stoyanchev
2d8b2fed8b Avoid dependency on netty-common in DataBufferUtils
See: gh-22594
2020-06-20 15:56:35 +01:00
Rossen Stoyanchev
78d1591e2d Merge branch '5.2.x' 2020-06-19 22:09:43 +01:00
Rossen Stoyanchev
f35903f23d Catch IllegalReferenceCountException
Closes gh-22594
2020-06-19 21:58:03 +01:00
Sébastien Deleuze
1e501f2583 Provide a flag to disable XML support
This commit introduces a spring.xml.ignore system property
which when set to true avoid initializing XML infrastructure.

A typical use case is optimizing GraalVM native image footprint
for applications not using XML. In order to be effective, those
classes should be initialized at build time:

- org.springframework.util.DefaultPropertiesPersister
- org.springframework.core.io.support.PropertiesLoaderUtils
- org.springframework.web.servlet.function.support.RouterFunctionMapping
- org.springframework.web.client.RestTemplate
- org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver
- org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
- org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
- org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter
- org.springframework.http.codec.support.BaseDefaultCodecs
- org.springframework.beans.PropertyEditorRegistrySupport

Closes gh-25151
2020-06-19 09:42:12 +02:00