Commit Graph

2275 Commits

Author SHA1 Message Date
Сергей Цыпанов 65aa2d03f0 Simplify conversion of ByteArrayOutputStream to String
Closes gh-24785
2020-03-26 16:52:14 +01:00
Brian Clozel d97eabba2f Do not cache multipart MIME types in cache
Prior to this commmit, "mutipart/*" MIME types would be cached by the
`MimeTypeUtils` LRU cache. Since those MIME types are likely to have
random boundaries in them, they can waste space in the LRU cache.
This is not improving things since we're parsing them anyway.

This commit skips the caching step for all "multipart" MIME types.

Fixes gh-24767
2020-03-24 10:59:05 +01:00
Juergen Hoeller 2209e7cb92 Reuse empty class array constant in ClassUtils
Closes gh-24221
2020-03-24 00:08:43 +01:00
Christoph Dreis 1c6dda3ca4 Improve performance of StringUtils#cleanPath 2020-03-23 23:25:15 +01:00
Juergen Hoeller 2e23cf32ce Clarify name generation responsibility for PropertySourceFactory impls
Closes gh-24757
2020-03-23 18:02:05 +01:00
Juergen Hoeller 10d47d4d21 Enable ASM8_EXPERIMENTAL for Java 14 record support
Closes gh-24722
2020-03-23 18:00:59 +01:00
Brian Clozel 831a95154e Polish ConcurrentLruCache
This commit improves the performance of the `ConcurrentLruCache` and
applies a consistent style to the code:

* separating read/write locks into different variables does not help
performance, so this change is reverted
* apply a consistent style for read/write locks and try/cactch calls
* the reordering of recently used keys is only done when the cache is
full

Fixes gh-24671
2020-03-22 21:49:07 +01:00
Kwangyong Kim 713a112812 Improve ConcurrentLruCache performance
- manage collection size manually
- check cache hit first before size check
- reduce read-lock scope
- use `map.get` to test cache instead of `queue.remove`

Closes gh-24469
See gh-24671
2020-03-22 21:48:55 +01:00
Qimiao Chen 09b36380cd
Fix typos in source files
Closes gh-24746
2020-03-20 20:06:52 +01:00
Sam Brannen 116a256e81 Fix typos in AnnotationsScannerTests 2020-03-20 15:03:01 +01:00
Qimiao Chen 2c5781473c
Improve Javadoc in AnnotatedElementUtils
Closes gh-24740
2020-03-20 15:00:17 +01:00
Qimiao Chen d85a6c0bea
Fix typos in MergedAnnotationsCollectionTests
Closes gh-24701
2020-03-15 11:48:29 +01:00
陈其苗 c5b8406def Add some test cases in StringUtilsTests 2020-03-13 12:35:04 +00:00
陈其苗 6013591fac Polish containsAny of CollectionUtils by reusing findFirstMatch 2020-03-13 12:32:43 +00:00
Juergen Hoeller 7f26e8cfc6 Short-circuit interface visibility check in case of same ClassLoader
Closes gh-24664
2020-03-11 14:55:08 +01:00
Sam Brannen 787b09b202 Relax GraalVM check in DefaultParameterNameDiscoverer
Prior to this commit, DefaultParameterNameDiscoverer did not register
any discovers when compiling or running as a GraalVM native image.

This commit relaxes the GraalVM check so that it is only applied to the
registration of KotlinReflectionParameterNameDiscoverer.

Consequently, StandardReflectionParameterNameDiscoverer and
LocalVariableTableParameterNameDiscoverer are once again always
registered by DefaultParameterNameDiscoverer.

Closes gh-24600
2020-02-26 14:18:56 +01:00
Rossen Stoyanchev 2f12351292 Refine BlockHound support
- disable for Java 14/15 for now until BlockHound support
- targeted installation of required integrations only
2020-02-25 10:07:29 +00:00
Rossen Stoyanchev 2ae91404d1 BlockHoundIntegration for spring-core 2020-02-24 17:19:32 +00:00
Sam Brannen 7778508e69 Fix typos in ResolvableTypeTests
See gh-24529

Co-authored-by: Qimiao Chen <chenqimiao1994@126.com>
2020-02-24 15:37:42 +01:00
Sam Brannen d1a6e49475 Reset SecurityManager in finally-block and polish 2020-02-23 18:33:56 +01:00
Sam Brannen 809ed9d469 Rename PropertyResolverExtensionsTests to Kotlin* 2020-02-23 18:21:53 +01:00
Qimiao Chen f78c21e40b
Fix typos in tests
Closes gh-24566
2020-02-22 18:32:02 +01:00
Sam Brannen 8ff1ac59e0 Polishing 2020-02-19 11:29:51 +01:00
Rossen Stoyanchev 87f866b688 Update DigestUtils Javadoc with regards to InputStream
Closes gh-24534
2020-02-18 19:56:25 +00:00
Sam Brannen 5d4f1d9e09 Extract ValueExtractor functional interface
See gh-24375
2020-02-12 10:49:36 +01:00
Sam Brannen 974cacac31 Support nested annotations in ASM-based processing again
Spring Framework 5.0 introduced a regression in ASM-based annotation
processing. Specifically, nested annotations were no longer supported,
and component scanning resulted in an exception if a candidate
component was annotated with an annotation that contained nested
annotations.

This commit fixes this regression by introducing special handling in
AnnotationTypeMapping that supports extracting values from objects of
type TypeMappedAnnotation when necessary.

Closes gh-24375
2020-02-12 10:36:54 +01:00
Rossen Stoyanchev d552105516 Eliminate windowUntil from StringDecoder
This is a follow-up on the earlier commit
28a95e89f3 eliminating windowUntil
entirely which generates a BubblingException wrapper. This also keeps
the chain a little simpler.

See gh-24355
2020-02-11 16:49:21 +00:00
Rossen Stoyanchev 28a95e89f3 Upgrade to Dysprosium SR5 snapshots
See gh-24355
2020-02-11 12:52:04 +00:00
Rossen Stoyanchev 7d1d989535 Minor polishing in ConcurrentReferenceHashMap
Closes gh-24494
2020-02-11 10:49:28 +00:00
Rossen Stoyanchev e4a530efac Minor refactoring in CommonsLogWriter
Closes gh-24495
2020-02-11 10:40:24 +00:00
Rossen Stoyanchev df706f4c7c Restore use of Flux-based encode method in HTTP
Closes gh-24441
2020-02-07 21:44:44 +00:00
Sam Brannen 2b6117c0c2 Fix Checkstyle violation
See gh-24393
2020-02-04 13:45:02 +01:00
Sam Brannen 72685b1d81 Polish contribution
See gh-24393
2020-02-04 13:41:31 +01:00
Hyunjin Choi d624dc084f
Add close() method in FileCopyUtils to reduce duplication
Closes gh-24393
2020-02-04 13:36:24 +01:00
Hyunjin Choi 550f13e8ed
Simplify GenericConversionService.getMatchableConverters()
Closes gh-24403
2020-02-04 12:59:57 +01:00
Rossen Stoyanchev f5df422de9 Polishing contribution
See gh-24470
2020-02-03 20:32:36 +00:00
Hyunjin Choi 273812f9c5 Remove unnecessary escapes in regular expressions
See gh-24470
2020-02-03 20:22:40 +00:00
Sam Brannen cf9a052e3a Polish contribution
See gh-24428
2020-02-03 15:39:00 +01:00
Hyunjin Choi 1b39f138eb
Test ObjectUtils.containsElement()
This commit introduces a unit test for the containsElement() method
in ObjectUtils.

Closes gh-24428
2020-02-03 15:34:47 +01:00
Hyunjin Choi 14a32d13d0
Fix typo in StringUtils class
Closes gh-24471
2020-02-03 15:23:32 +01:00
Sam Brannen d77a28aac3 Support optional command line arguments with empty values
Spring Framework provides two implementations of the
CommandLinePropertySource API: SimpleCommandLinePropertySource and
JOptCommandLinePropertySource.

Prior to this commit, JOptCommandLinePropertySource supported empty
values for optional arguments; whereas, SimpleCommandLinePropertySource
did not.

This commit modifies the implementation of SimpleCommandLinePropertySource
to allow empty values for optional arguments.

Closes gh-24464
2020-02-03 15:03:43 +01:00
Sam Brannen daebbf1960 Polishing 2020-01-31 14:34:50 +01:00
Сергей Цыпанов 64440a5f04 Some trivial improvements to reduce allocation pressure
Closes gh-24447
2020-01-28 11:07:40 +01:00
Juergen Hoeller 75abd9fc7e Upgrade to ASM 7.3
Closes gh-24438
2020-01-27 18:18:16 +01:00
Kalmesh Sambrani d085577e0a Solve ReflectPermission Issue in Sandbox Security Policy Model 2020-01-24 14:15:39 +01:00
Sam Brannen b34404916a Update copyright date 2020-01-17 18:15:16 +01:00
Сергей Цыпанов 3adc7c3059 Hoist concatenation of two constant Strings out of loops
Closes gh-24388
2020-01-17 16:59:39 +01:00
Sam Brannen daa30a9f0b Consistent use of AnnotationUtils.rethrowAnnotationConfigurationException()
Closes gh-24379
2020-01-16 18:19:11 +01:00
Sam Brannen 6c2cb8ecf5 Polish contribution
See gh-24351
2020-01-14 17:33:02 +01:00
hyeonisism f1827cb1f9 Add tests for StringUtils split() method
Closes gh-24351
2020-01-14 17:20:38 +01:00
Sam Brannen 33ffdd865d Update copyright date 2020-01-13 16:29:23 +01:00
Qimiao Chen c84dd55863 Fix typo in ReflectionUtilsTests
Closes gh-24344
2020-01-13 16:27:05 +01:00
Rossen Stoyanchev cbc57460b7 Support for maxInMemorySize in SSE reader
Closes gh-24312
2020-01-13 14:57:14 +00:00
Rossen Stoyanchev a741ae422b Improve limit handling in StringDecoder
The case of one data buffer containing multiple lines can could cause
a buffer leak due to a suspected issue in concatMapIterable. This
commit adds workarounds for that until the underlying issue is
addressed.

Closes gh-24339
2020-01-13 14:57:14 +00:00
Sam Brannen cb8db1e6df Polish Javadoc 2020-01-10 16:05:33 +01:00
Juergen Hoeller 4936a637fe Polishing 2020-01-09 17:03:17 +01:00
Juergen Hoeller c39ed52f97 Add since tag to hasMethod(Class, Method)
See gh-24282
2020-01-08 19:05:03 +01:00
stsypanov 8e5cad2af3 Add fast path for ClassUtils.hasMethod() 2020-01-08 18:52:15 +01:00
Rossen Stoyanchev 01827389ef Polishing contribution
See gh-24292
2020-01-08 16:19:25 +00:00
Oleh Faizulin e96b71acf3 contentLength support for Resource decoding
Expose the known content length, if known, in the InputStreamResource returned by ResourceHttpMessageConverter or
ResourceDecoder.

See gh-24292
2020-01-08 16:19:11 +00:00
Sam Brannen 3299793c8a Polish [Simple]AliasRegistry[Tests] 2020-01-06 11:30:05 +01:00
Qimiao Chen d0c2812dad Optimize SimpleAliasRegistry hasAlias implementation
This commit reduces the number of loops and recursions in
the implementation of SimpleAliasRegistry#hasAlias().

Closes gh-24295
2020-01-06 11:28:24 +01:00
Sam Brannen 081b3d304d Move JavaUtilLoggingConfigurer to spring-core test fixtures
See gh-23550
2020-01-03 14:34:29 +01:00
Sam Brannen 94f8ef08e2 Move common TestPrincipal to spring-core test fixtures
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 4260c34b47 Rename test fixture package in spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen 5718bf424b Use Gradle test fixture support for spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Rossen Stoyanchev 0eacb443b0 Reuse InputStream in ResourceRegionHttpMessageConverter
The converter now tries to keep reading from the same InputStream which
should be possible with ordered and non-overlapping regions. When
necessary the InputStream is re-opened.

Closes gh-24214
2019-12-18 16:22:53 +00:00
Juergen Hoeller 0711e58a5f Un-deprecate PathResource (for NIO Path resolution in createRelative)
Includes aligned createRelative signature and dedicated java.io.File test.

Closes gh-24211
2019-12-16 16:50:04 +01:00
Juergen Hoeller f353bc0c25 ConcurrentReferenceHashMap cache for getInterfaceMethodIfPossible results
Closes gh-24206
2019-12-16 16:49:39 +01:00
Sam Brannen 17edbec035 Polishing 2019-12-13 16:30:03 +01:00
Sam Brannen 49ddf798e0 Polish ClassUtils.resolvePrimitiveClassName()
See gh-24192
2019-12-13 15:47:05 +01:00
Juergen Hoeller fa8f08391f Consistent use of annotation-api dependency instead of tomcat-embed-core 2019-12-12 17:21:41 +01:00
Sam Brannen d757f73902 Handle exceptions in annotation searches again
Prior to Spring Framework 5.2, most annotation search algorithms made
use of AnnotationUtils.handleIntrospectionFailure() to handle exceptions
thrown while attempting to introspect annotation metadata. With the
introduction of the new MergedAnnotation API in Spring Framework 5.2,
this exception handling was accidentally removed.

This commit introduces the use of handleIntrospectionFailure() within
the new MergedAnnotation internals in order to (hopefully) align with
the previous behavior.

Closes gh-24188
2019-12-12 11:29:06 +01:00
Sam Brannen 6e21b19999 Make TYPE_HIERARCHY_AND_ENCLOSING_CLASSES annotation search strategy defensive
Prior to this commit, when searching for annotations using the
TYPE_HIERARCHY_AND_ENCLOSING_CLASSES strategy an exception could be
thrown while attempting to load the enclosing class (e.g., a
NoClassDefFoundError), thereby halting the entire annotation scanning
process.

This commit makes this search strategy defensive by logging exceptions
encountered while processing the enclosing class hierarchy instead of
allowing the exception to halt the entire annotation scanning process.

The exception handling is performed by
AnnotationUtils.handleIntrospectionFailure() which only allows an
AnnotationConfigurationException to propagate.

See gh-24136
2019-12-10 22:38:55 +01:00
Sam Brannen 16ed7e2a19 Only load enclosing class for TYPE_HIERARCHY_AND_ENCLOSING_CLASSES strategy
Prior to this commit, the enclosing class was always eagerly loaded
even if the annotation search strategy was not explicitly
TYPE_HIERARCHY_AND_ENCLOSING_CLASSES.

See gh-24136
2019-12-10 22:08:26 +01:00
Sam Brannen 76bc581528 Polishing 2019-12-10 22:06:22 +01:00
Sam Brannen 2bd821c909 Improve exception for mixed explicit/implicit aliases with @AliasFor
Given the following improperly configured composed @RequestMapping
annotation:

@Retention(RetentionPolicy.RUNTIME)
@RequestMapping
@interface PostApi {

	@AliasFor("value")
	String[] path() default {};

	@AliasFor(annotation = RequestMapping.class, attribute = "path")
	String[] value() default {};
}

Prior to this commit, an attempt to process the above annotation
resulted in an exception similar to the following, which is not
especially helpful to discern the problem.

> Attribute 'value' in annotation [PostApi] must be declared as an
> @AliasFor 'path', not 'path'.

This commit improves the exception message for such scenarios,
resulting in an exception message similar to the following.

> Attribute 'value' in annotation [PostApi] must be declared as an
> @AliasFor attribute 'path' in annotation [PostApi], not attribute
> 'path' in annotation [RequestMapping].

Closes gh-24168
2019-12-10 14:36:11 +01:00
Sam Brannen 4466114cfa Polishing 2019-12-10 14:26:48 +01:00
Juergen Hoeller 2c03246f00 Polishing 2019-12-09 15:58:21 +01:00
Juergen Hoeller 2d2993dffb Cleanup of "varaible" typos in ResolvableTypeTests 2019-12-09 14:03:56 +01:00
Juergen Hoeller a4f75e9c6a Polishing 2019-12-09 13:29:00 +01:00
stsypanov ebbb562cb9 Hoist constant result of SerializableTypeWrapper.unwrap() out of loop 2019-12-09 13:14:10 +01:00
PyvesB e15ccdb35d Polish DataBufferUtils javadoc
See gh-24160
2019-12-08 14:01:55 +01:00
stsypanov 484006ce90 Hoist Class.getName() from String concatenation to dodge an issue related to profile pollution 2019-12-06 17:36:07 +01:00
Phillip Webb 7c84695333 Support variable resolution of wildcard types
Update `ResolvableType` so that variable referenced can be resolved
against wildcard types. Prior to this commit, given a type:

	Map<String, ? extends List<? extends CharSequence>>

Calling `type.getGeneric(1).asCollection().resolveGeneric()` would
return `null`. This was because the `List` variable `E` referenced a
wildcard type which `resolveVariable` did not support.

Closes gh-24145
2019-12-06 13:38:46 +01:00
Sam Brannen a4fa6a7a31 Test status quo for @Inherited annotation support in AnnotationMetadata 2019-12-05 23:30:14 +01:00
Sam Brannen 3b9d1a00b0 Polishing 2019-12-05 22:37:00 +01:00
Juergen Hoeller c2141e2e93 Add @since tags to firstElement methods 2019-12-05 16:36:55 +01:00
Vitalii Rastvorov d503bc2804 Add firstElement to CollectionUtils 2019-12-05 16:26:25 +01:00
Sam Brannen fb13f6f0bc Add integration test for gh-24110 2019-12-03 16:48:30 +01:00
wanxiangming1994 6f15f32be3 Honor default values for implicit aliases in composed annotations
Spring Framework 5.2 introduced a regression for implicit aliases
declared via @AliasFor. Specifically, Spring's merged annotation
algorithms stopped honoring default values for implicit alias pairs if
the composed annotation was used without specifying the aliased
attributes.

This commit fixes this regression.

Closes gh-24110
2019-12-03 16:14:49 +01:00
Sam Brannen 279777b2f3 Polishing 2019-12-02 16:22:40 +01:00
Sam Brannen d9ebc3bbc4 Polish StringArrayPropertyEditor[Tests] 2019-11-29 14:55:18 +01:00
Sam Brannen 7cedffc707 Support @Inherited again in reflection-based AnnotationMetadata
Spring Framework 5.2 introduced a regression in reflection-based
AnnotationMetadata. Specifically, as of 5.2, StandardAnnotationMetadata
no longer found @Inherited annotations from superclasses.

This commit fixes this regression by switching to the INHERITED_ANNOTATIONS
SearchStrategy when creating the MergedAnnotations used within
StandardAnnotationMetadata,

Note, however, that the discrepancy between StandardAnnotationMetadata
and SimpleAnnotationMetadata (i.e., reflection-based vs. ASM-based)
regarding @Inherited support still remains as it was prior to Spring
Framework 5.2.

Closes gh-24077
2019-11-29 00:07:44 +01:00
Sam Brannen 85016aef30 Test status quo for @Inherited annotations in AnnotationMetadata
This commit introduces failing assertions that are currently disabled
via a boolean reproduceGh24077 flag.

Setting that flag to true demonstrates the regression for
StandardAnnotationMetadata and inconsistencies for SimpleAnnotationMetadata.

See gh-24077
2019-11-28 18:45:58 +01:00
Sam Brannen d1f544209e Test status quo for AnnotatedTypeMetadata.getAnnotationAttributes()
See gh-24077
2019-11-28 13:50:35 +01:00
Sébastien Deleuze 712eac2915 Refine Coroutines annotated controller support
This commit refines Coroutines annotated controller support
by considering Kotlin Unit as Java void and using the right
ReactiveAdapter to support all use cases, including suspending
functions that return Flow (usual when using APIs like WebClient).

It also fixes RSocket fire and forget handling and adds related tests
for that use case.

Closes gh-24057
Closes gh-23866
2019-11-22 14:13:17 +01:00
Juergen Hoeller 06b1f31cdd SynthesizedMergedAnnotationInvocationHandler does not pre-load values
Closes gh-24029
2019-11-19 14:54:12 +01:00
Juergen Hoeller 4af6039359 Avoid substring allocation in StringUtils.replace
Closes gh-24023
2019-11-19 14:53:30 +01:00
Juergen Hoeller 830f81210f Revise getElementTypeDescriptor javadoc (no IllegalStateException)
Closes gh-23996
2019-11-14 18:31:32 +01:00
Sébastien Deleuze 029e61f54a Refine MethodParameter#isOptional Kotlin implementation
This commit adds support for Continuation parameter that is now
considered as an optional parameter since it is never provided by
the user.

It also simplifies and optimizes the implementation.

Closes gh-23991
2019-11-14 15:28:06 +01:00
Juergen Hoeller 22211a01ce Polishing 2019-11-13 17:23:23 +01:00
Rossen Stoyanchev f2b9264674 Remove Jetbrains annotations 2019-11-13 14:42:32 +00:00
Sébastien Deleuze 7646895fd4 Support Kotlin synthetic classes in MethodParameter and SpEL
Closes gh-23812
2019-11-13 14:22:53 +01:00
stsypanov f2b3953d76 Use array.clone() instead of manual array creation 2019-11-13 13:53:42 +01:00
Juergen Hoeller 9cc06454aa Restore findAnnotation superclass traversal for java.lang annotations
Closes gh-23929
2019-11-12 11:51:44 +01:00
Arjen Poutsma 789f6fc188 Add @Nullable annotation to decode method taking DataBuffer
Javadoc indicates the returned value can be null.
2019-11-11 16:48:30 +01:00
Andy Wilkinson b5fb28284e Upgrade to Shadow Plugin 5.2.0
Closes gh-23971
2019-11-11 14:56:40 +01:00
Juergen Hoeller 6a48bb7b4d Polishing 2019-11-07 22:08:29 +01:00
stsypanov f5ae3c77c6 Use Method::getParameterCount where possible 2019-11-07 18:00:15 +01:00
Sam Brannen 29b31cad48 Align implementations of StringToUUIDConverter and UUIDEditor
Closes gh-23940
2019-11-06 14:21:52 +01:00
Sam Brannen 01fb35bd2d Remove TestGroup.CI enum constant
Prior to this commit, the TestGroup.CI enum constant was only used in a
single test method in spring-core. In order to enable that test, the
`testGroups` JVM system property was configured for the
Publication-master CI build plan; however, the `testGroups` system
property is not set when executing local builds. Consequently, there
has been a Gradle cache miss for every `test` task when building
something locally that's already been built on the CI server.

This commit addresses this issue by removing the `TestGroup.CI` enum
constant. The `-PtestGroups=ci` command line configuration for the
Publication-master CI build plan has also been removed on the CI server.

Closes gh-23918
2019-11-04 15:44:53 +01:00
François Guillot 2411b657ae Fix spring-core jar task 'up-to-date'-ness
See gh-23729
2019-11-04 10:29:58 +01:00
Sam Brannen 95af079906 Document unidirectional @AliasFor attribute mapping support
See gh-23834
2019-10-31 15:27:27 +01:00
Sam Brannen 9f00eb68e9 Clean up warnings 2019-10-30 19:14:58 +01:00
Christoph Dreis 3c17178b16 Fix Mockito deprecations 2019-10-30 18:30:05 +01:00
Juergen Hoeller 19ff7d84ab Polishing 2019-10-30 14:31:46 +01:00
Juergen Hoeller 42e7ade110 Tolerate unidirectional alias declaration for annotation attribute pair
Closes gh-23834
2019-10-30 14:31:09 +01:00
Juergen Hoeller dba7bf7ec1 Avoid unnecessary setAccessible call in AttributeMethods
Closes gh-23829
2019-10-30 14:30:26 +01:00
Juergen Hoeller dc59e50561 Avoid unnecessary use of ResolvableType within MethodParameter
Closes gh-23792
2019-10-30 01:04:26 +01:00
Juergen Hoeller d51ab24a1b Latest dependency updates (Tomcat 9.0.27, Undertow 2.0.27, RxJava 2.2.13, Gson 2.8.6, Apache Johnzon 1.2.1, Hibernate ORM 5.4.8, EclipseLink 2.7.5, H2 1.4.200, POI 4.1.1, Quartz 2.3.2, WebJars Locator 0.42, HtmlUnit 2.36, Checkstyle 8.26, Mockito 3.1, Objenesis 3.1) 2019-10-30 00:26:45 +01:00
Rossen Stoyanchev 5abf24e7d7 Expose maxInMemorySize via CodecConfigurer
Centralized maxInMemorySize exposed via CodecConfigurer along with
ability to plug in an instance of MultipartHttpMessageWrite.

Closes gh-23884
2019-10-29 12:33:16 +00:00
Brian Clozel 69bcdfc17f Polishing 2019-10-29 12:33:16 +00:00
Rossen Stoyanchev 89d053d7f4 Limits on input stream in codecs
- Add maxInMemorySize property to Decoder and HttpMessageReader
  implementations that aggregate input to trigger
  DataBufferLimitException when reached.

- For codecs that call DataBufferUtils#join, there is now an overloaded
  variant with a maxInMemorySize extra argument. Internally, a custom
  LimitedDataBufferList is used to count and enforce the limit.

- Jackson2Tokenizer and XmlEventDecoder support those limits per
  streamed JSON object.

See gh-23884
2019-10-29 12:33:16 +00:00
Phillip Webb 013ec6abdb Support customer repeatable containers in type map
Update `AnnotationTypeMappings` so that a custom `RepeatableContainers`
instances can be used. Prior to this commit, only standard repeatables
were used when reading the annotations. This works in most situations,
but causes regressions for some `AnnotationUtils` methods.

Fixed gh-23856
2019-10-24 13:20:11 -07:00
Sam Brannen f8b875d2d8 Introduce failing @Disabled test for gh-23856 2019-10-24 16:15:59 +02:00
Sam Brannen 71400ea604 Polish MergedAnnotation internals 2019-10-22 13:58:13 +02:00
Sam Brannen 2146bc816a Fix Checkstyle violations
See gh-23767
2019-10-22 12:40:38 +02:00
Phillip Webb ad543dbee3 Use mapped annotation values when resolving mirrors
Update `TypeMappedAnnotation` mirror resolution logic so that mapped
annotation values are also considered. Prior to this commit, mirrors
in more complex meta-annotation scenarios would not resolve correctly.

Specifically, given the following:

 @interface TestAliased {

 	@AliasFor(attribute = "qualifier")
 	String value() default "";

 	@AliasFor(attribute = "value")
 	String qualifier() default "";
 }

 @TestAliased
 @interface TestMetaAliased {

 	@AliasFor(annotation = Aliased.class, attribute = "value")
 	String value() default "";
 }

 @TestMetaAliased("test")
 @interface TestComposed {
 }

A merged `@TestAliased` annotation obtained from a `@TestComposed`
root annotation would return a `value` and `qualifier` of "".

This was because the "value" and "qualifier" mirrors needed to be
resolved against the `@TestMetaAliased` meta-annotation. They cannot be
resolved against the declared `@TestComposed` annotation because it
does not have any attributes. Our previous tests only covered a single
depth scenario where `@TestMetaAliased` was used directly on the
annotated element.

Closes gh-23767
Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2019-10-21 21:57:30 -07:00
Sam Brannen b1a938fa24 Polishing 2019-10-21 13:51:37 -07:00
Stephane Nicoll 29f0d1b25e Remove TODO in AnnotationUtils
Closes gh-23727
2019-09-30 07:57:12 +02:00
Juergen Hoeller 2861fc65bd Polishing 2019-09-27 10:17:56 +02:00
Sam Brannen 2526553ecd Document terms and units in DataSize and DataUnit
Prior to this commit, it was not readily apparent what terms and units
such as kilobyte/KB and megabyte/MB represented numerically in DataSize
and DataUnit.

This commit clarifies that such terms and units are based on binary
prefixes for data (i.e., powers of 2 instead of powers of 10).

Closes gh-23697
2019-09-26 16:05:12 +02:00
Sam Brannen 77b896ca28 Polishing 2019-09-26 11:58:45 +02:00
Sebastien Deleuze 091c512f0d Upgrade to Coroutines 1.3.2
Closes gh-23663
2019-09-25 21:51:04 +02:00
Juergen Hoeller bd70f10d2b Merge branch '5.1.x'
# Conflicts:
#	build.gradle
#	spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
#	spring-aspects/spring-aspects.gradle
#	spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
#	spring-beans/src/main/java/org/springframework/beans/factory/support/GenericBeanDefinition.java
#	spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
#	spring-orm/spring-orm.gradle
#	spring-test/spring-test.gradle
2019-09-25 12:43:24 +02:00
Juergen Hoeller bb6f9bb6d4 Polishing 2019-09-25 12:14:48 +02:00
Sam Brannen e6678f40e8 Make DataSize constants final 2019-09-24 15:32:26 +02:00
Sam Brannen 402046f3c7 Polish data buffer allocation tests 2019-09-24 14:24:36 +02:00
Sam Brannen bba3553dfb Polish SpringVersion 2019-09-24 12:43:10 +02:00
Sam Brannen 4acd180fa3 Document that setting static final fields is unsupported
This commit updates the documentation for ReflectionUtils and
ReflectionTestUtils to point out that setting static final fields is
not supported.
2019-09-21 15:42:09 +02:00
Sam Brannen fccdb8cf60 Polish ReflectionUtils
This commit removes dead code in ReflectionUtils and improves the
exception message for field access errors.
2019-09-21 15:29:03 +02:00
Juergen Hoeller 4882dfcc0d Consistent relative path treatment (no accidental URL fragment symbol)
Closes gh-23532
2019-09-20 21:55:27 +02:00
Juergen Hoeller 957924ace2 Avoid early log provider initialization (and LogAccessor dependency)
Closes gh-23655
2019-09-20 21:54:53 +02:00
Stephane Nicoll 37d950c5d6 Merge branch '5.1.x' 2019-09-16 14:37:15 +02:00
Stephane Nicoll b65984a078 Consume getProtocolResolvers() rather than internal list
This commit makes sure that DefaultResourceLoader consistently use
getProtocolResolvers() to access additional protocol resolvers. This
allows subclasses to define how the list is provided.

Closes gh-23564
2019-09-16 14:35:00 +02:00
Phillip Webb d945ae9191 Add blank line between java and javax imports
See gh-23539

Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2019-09-16 13:41:59 +02:00
Sam Brannen d09f537699 Annotate Object#equals parameter with @nullable
See gh-23093

Co-authored-by: Sebastien Deleuze <sdeleuze@pivotal.io>
2019-09-16 12:43:13 +02:00
Juergen Hoeller c8f20815ef Revise LinkedCaseInsensitiveMap's lazy key/value/entry collections
Closes gh-22926
2019-09-16 12:38:46 +02:00
Juergen Hoeller 60976e4116 Add missing nullable declarations
See gh-22821
2019-09-16 12:37:49 +02:00