Commit Graph

2907 Commits

Author SHA1 Message Date
Sam Brannen 96e4d3a530 Fail Gradle build for Javadoc warnings
In order to catch Javadoc errors in the build, we now enable the
`Xwerror` flag for the `javadoc` tool. In addition, we now use
`Xdoclint:syntax` instead of `Xdoclint:none` in order to validate
syntax within our Javadoc.

This commit fixes all resulting Javadoc errors and warnings.

This commit also upgrades to Undertow 2.2.12.Final and fixes the
artifact names for exclusions for the Servlet and annotations APIs.

The incorrect exclusion of the Servlet API resulted in the Servlet API
being on the classpath twice for the javadoc task, which resulted in the
following warnings in previous builds.

javadoc: warning - Multiple sources of package comments found for package "javax.servlet"
javadoc: warning - Multiple sources of package comments found for package "javax.servlet.http"
javadoc: warning - Multiple sources of package comments found for package "javax.servlet.descriptor"
javadoc: warning - Multiple sources of package comments found for package "javax.servlet.annotation"

Closes gh-27480
2021-09-29 14:02:37 +02:00
Juergen Hoeller 4d7fa9a632 Merge branch '5.3.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
2021-09-28 18:18:23 +02:00
Juergen Hoeller 040445612f Polishing 2021-09-28 18:15:56 +02:00
Sam Brannen 08bce08018 Use text blocks with JUnit Jupiter 5.8.1
See gh-27450
2021-09-28 14:20:31 +02:00
Sam Brannen 93efb20a53 Fix broken links in Javadoc
This commit removes several links that were broken due to the removal
of various APIs in 6.0.

See gh-27480
2021-09-28 13:34:33 +02:00
Sam Brannen 3dc84c2d92 Merge branch '5.3.x' 2021-09-28 11:48:50 +02:00
Sam Brannen bfdc99ab79 Fix Javadoc errors
See gh-27480
2021-09-28 11:44:12 +02:00
Sam Brannen 16bf39ea1b Merge branch '5.3.x' 2021-09-28 10:35:18 +02:00
Sam Brannen 2567b20949 Upgrade to spring-javaformat 0.0.28 and downgrade to Checkstyle 8.41
In order to be able to use text blocks and other new Java language
features, we are upgrading to a recent version of Checkstyle.

The latest version of spring-javaformat-checkstyle (0.0.28) is built
against Checkstyle 8.32 which does not include support for language
features such as text blocks. Support for text blocks was added in
Checkstyle 8.36.

In addition, there is a binary compatibility issue between
spring-javaformat-checkstyle 0.0.28 and Checkstyle 8.42. Thus we cannot
use Checkstyle 8.42 or higher.

In this commit, we therefore upgrade to spring-javaformat-checkstyle
0.0.28 and downgrade to Checkstyle 8.41.

This change is being applied to `5.3.x` as well as `main` in order to
benefit from the enhanced checking provided in more recent versions of
Checkstyle.

Closes gh-27481
2021-09-28 10:29:31 +02:00
Juergen Hoeller b3f6d60dc9 Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java
#	spring-core/src/test/java/org/springframework/core/ReactiveAdapterRegistryTests.java
#	src/docs/asciidoc/web-reactive.adoc
2021-09-27 17:26:26 +02:00
Juergen Hoeller 119c78b1c9 Skip flaky StopWatch time assertions 2021-09-27 17:11:12 +02:00
Juergen Hoeller b0c424b376 Deprecate RxJava 2 in favor of RxJava 3
Closes gh-27474
2021-09-27 16:56:28 +02:00
Juergen Hoeller e6112344d2 Remove support for RxJava 2.x as well
Includes realignment of Reactor adapter registration.

Closes gh-27443
2021-09-27 13:01:32 +02:00
Juergen Hoeller 0241c5ebb3 Merge branch '5.3.x'
# Conflicts:
#	spring-core/spring-core.gradle
2021-09-23 15:59:32 +02:00
Juergen Hoeller e29cfa3501 Polishing 2021-09-23 15:57:43 +02:00
Juergen Hoeller 208fafa4a3 Fix contract violations in ConcurrentReferenceHashMap's EntrySet/Iterator
Closes gh-27454
2021-09-23 15:56:49 +02:00
Juergen Hoeller 8f96ca4a2d Merge branch '5.3.x'
# Conflicts:
#	spring-context/spring-context.gradle
#	spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java
2021-09-21 17:47:27 +02:00
Juergen Hoeller 1f8c233dfc Polishing 2021-09-21 17:43:03 +02:00
Juergen Hoeller eabe946a53 Skip readStream optimization for compatibility with misbehaving InputStreams
Closes gh-27429
2021-09-21 17:41:56 +02:00
Juergen Hoeller 3beb074278 Remove support for RxJava 1.x
Also removes unnecessary flowPublisherPresent check on JDK 9+, depending on Reactor presence for its JDK Flow adapter instead.

Closes gh-27443
2021-09-21 09:13:06 +02:00
Brian Clozel cce61c3918 Merge branch '5.3.x' 2021-09-17 15:30:16 +02:00
Brian Clozel a50537fbaf Polish "Fix collectionToDelimitedString failure for null elements."
Fixes gh-27419
2021-09-17 15:15:51 +02:00
Koy 0d6cc12274 Fix collectionToDelimitedString failure for null elements.
Prior to this commit, calling `StringUtils#collectionToDelimitedString`
would fail with an NPE if the collection contains null elements.

This commit ensures that null elements are converted as `"null"` in the
resulting String without failure.

See gh-27419
2021-09-17 15:15:26 +02:00
Juergen Hoeller d84ca2ba90 Jakarta EE 9 migration
Upgrades many dependency declarations; removes old EJB 2.x support and outdated Servlet-based integrations (Commons FileUpload, FreeMarker JSP support, Tiles).

Closes gh-22093
Closes gh-25354
Closes gh-26185
Closes gh-27423
See gh-27424
2021-09-17 09:14:07 +02:00
Juergen Hoeller b74e93807e Remove JDK 9 workarounds etc
See gh-17778
2021-09-17 08:58:19 +02:00
Juergen Hoeller cf2429b0f0 Remove support for deprecated Java SecurityManager (-> JDK 17 build compatibility)
Includes hard JDK 9+ API dependency in CGLIB ReflectUtils (Lookup.defineClass) and removal of OutputStream spy proxy usage (avoiding invalid Mockito proxy on JDK 17)

Closes gh-26901
2021-09-15 15:30:25 +02:00
Juergen Hoeller 3baacedfd9 Alignment with other abstract utils classes 2021-09-14 21:49:12 +02:00
Sam Brannen 18ee308e4e Delete obsolete Assume test utility 2021-09-14 10:58:38 +02:00
Phillip Webb 52b03e3326 Migrate CoroutinesUtils to Java
Migrate `CoroutinesUtils` from Kotlin code to Java and drop the
`kotlin-coroutines` module.

This update removes the need for Kotlin tooling IDE plugins to be
installed.

Closes gh-27379
2021-09-13 17:39:45 +02:00
Brian Clozel cecc0849a8 Upgrade to Gradle 7.2
This commit upgrades Gradle to 7.2.
Gradle configuration names are updated accordingly.
This also upgrades Gradle build plugins.

See gh-26870
2021-09-13 09:37:35 +02:00
Rossen Stoyanchev 41ab268733 Polishing contribution
See gh-27331
2021-09-09 17:00:00 +01:00
hantsy 1dc128361f Add SmallRye Mutiny adapters
Closes gh-26222
2021-09-09 16:43:08 +01:00
Juergen Hoeller 164dcef6ae Tracking ASM master
See gh-27069
2021-09-02 22:19:57 +02:00
Brian Clozel cc026fcb8a Polish "Optimize allocation in StringUtils#cleanPath"
This commit also introduces JMH benchmarks related to the code
optimizations.

Closes gh-2631
2021-08-30 18:26:51 +02:00
Daniel Knittl-Frank 8d3e8ca3a2 Optimize allocation in StringUtils#cleanPath
This commit applies several optimizations to StringUtils#cleanPath and
related methods:

* pre-size pathElements deque in StringUtils#cleanPath with
  pathElements.length elements, since this this is the maximum size and
  the most likely case.
* optimize StringUtils#collectionToDelimitedString to calculate the size
  of the resulting String and avoid array auto-resizing in the
  StringBuilder.
* If the path did not contain any components that required cleaning,
  return the (normalized) path as-is. No need to concatenate the prefix
  and the trailing path.

See gh-26316
2021-08-30 18:09:52 +02:00
Stephane Nicoll af6fd6c303 Polish "Fix duplicate "the" in Javadoc and XSD"
See gh-27291
2021-08-19 08:54:38 +02:00
Sanghyuk Jung ac72277258 Fix duplicate "the" in Javadoc and XSD
See gh-27291
2021-08-19 08:44:03 +02:00
Stephane Nicoll 31b651a114 Polish contribution
See gh-27248
2021-08-08 11:33:26 +02:00
Syuziko eaf9deedfd Polish tests
See gh-27248
2021-08-07 18:53:47 +02:00
Sam Brannen 915f1027a5 Update copyright date
See gh-27223
2021-07-29 11:04:59 +02:00
Mateusz Swiatkowski f1b35f1593
Fix reference to Optional.isPresent() in ObjectUtils.isEmpty()
Closes gh-27223
2021-07-29 11:03:26 +02:00
Sam Brannen 3ccbf1edeb Increase fudge factor in StopWatchTests 2021-06-30 10:43:52 +02:00
Sam Brannen a2ef6badc4 Use StringBuilder.append(char) where possible
To slightly improve performance, this commit switches to
StringBuilder.append(char) instead of StringBuilder.append(String)
whenever we append a single character to a StringBuilder.

Closes gh-27098
2021-06-25 10:44:28 +02:00
Sam Brannen ddbb7c1b5b Avoid use of Supplier in MergedAnnotationReadingVisitor.get 2021-06-24 16:41:28 +02:00
Sam Brannen 2bc7a3aa0a Implement equals, hashCode, & toString in BeanMethod and *Metadata types
Prior to this commit, ConfigurationClass implemented equals(),
hashCode(), and toString(), but BeanMethod did not.

This commit introduces equals(), hashCode(), and toString()
implementations in BeanMethod for consistency with ConfigurationClass
to make it possible to use BeanMethod instances to index additional
metadata as well.

In order to properly implement equals() in BeanMethod, the method
argument types are required, but these are not directly available in
BeanMethod. However, they are available via ASM when processing @Bean
methods. This commit therefore implements equals(), hashCode(), and
toString() in SimpleMethodMetadata which BeanMethod delegates to.

For completeness, this commit also implements equals(), hashCode(), and
toString() in StandardClassMetadata, StandardMethodMetadata, and
SimpleAnnotationMetadata.

Closes gh-27076
2021-06-24 16:41:28 +02:00
Sam Brannen 882004fc9b Fix bug in SimpleMethodMetadataReadingVisitor.Source.toString()
Prior to this commit, the toString() implementation did not separate
method argument types with a comma or any form of separator, leading
to results such as:

    org.example.MyClass.myMethod(java.lang.Stringjava.lang.Integer)

instead of:

    org.example.MyClass.myMethod(java.lang.String,java.lang.Integer)

Closes gh-27095
2021-06-24 16:41:28 +02:00
Sam Brannen 1bc236785c Polishing 2021-06-24 15:47:24 +02:00
Sam Brannen d469f6215d Polishing 2021-06-22 19:54:05 +02:00
Juergen Hoeller edf0343cfe Upgrade to ASM master (including early support for Java 18 bytecode)
Closes gh-27069
2021-06-22 15:26:35 +02:00
Sam Brannen 782d7169e4 Polish Javadoc for MethodMetadata 2021-06-21 18:04:37 +02:00
Juergen Hoeller d29d4d45aa Upgrade to ASM master
Closes gh-27023
2021-06-07 12:28:17 +02:00
Sam Brannen 432fdad7d0 Polish contribution
See gh-26982
2021-06-04 15:32:29 +02:00
nhavuong 345d8186d4 Add more test cases for SimpleAliasRegistry
Closes gh-26982
2021-06-04 15:18:46 +02:00
Сергей Цыпанов c9d341e9c0
Simplify String construction in StringUtils.changeFirstCharacterCase()
Closes gh-27012
2021-06-04 11:49:59 +02:00
Angel Aguilera 950b183715
Adjust expected IdentityHashMap sizes in ClassUtils
Proposed change aimed to keep coherence between variable declaration 
and static initialization code, which stores 9 values, not 8, in these
two maps.

Closes gh-27016
2021-06-04 10:48:44 +02:00
Brian Clozel 7dbbf364f7 Make FlightRecorderApplicationStartup thread safe
Prior to this commit, in some cases application context startup steps
could be created concurrently, which could cause issues with the current
implementation tracking the parent/child relationship between steps.

This commit ensures that the flight recorder implementation is using
thread safe collection implementations for that.

Fixes gh-26941
2021-06-01 15:11:23 +02:00
Brian Clozel 5204d736f3 Return static DefaultApplicationStartup step
This commit ensures that `DefaultApplicationStartup` returns a static
step for each call to avoid allocations.

Closes gh-26939
2021-06-01 15:06:19 +02:00
izeye ab2c78a9d5 Fix broken Javadoc tags
Closes gh-26967
2021-05-23 18:09:34 +02:00
Sébastien Deleuze 3dba3691a7 Upgrade to Coroutines 1.5.0
This commit upgrades to Coroutines 1.5.0 while retaining
Coroutines 1.4.x compatibility.

Closes gh-26897
2021-05-17 11:37:02 +02:00
Sam Brannen e31a4c4c77 Polishing 2021-05-12 11:31:15 +02:00
Juergen Hoeller 1469bdbc70 Nullability refinements and related polishing 2021-05-11 16:50:19 +02:00
Arjen Poutsma b18cf3c873 Follow contract of computeIfAbsent LinkedCaseInsensitiveMap
This commit makes sure that LinkedCaseInsensitiveMap::computeIfAbsent
honors the contract of the method, and also replaces the old entry if
that mapped to null.

Closes gh-26868
2021-04-30 15:49:00 +02:00
Arjen Poutsma 399e7ebf22 Follow contract of putIfAbsent LinkedCaseInsensitiveMap
This commit makes sure that LinkedCaseInsensitiveMap::putIfAbsent honors
the contract of the method, and also replaces the old entry if that
mapped to null.

Closes gh-26868
2021-04-30 15:17:46 +02:00
Sam Brannen ff9b68c1b6 Update copyright date for StaxEventXMLReader
See gh-26875
2021-04-29 18:01:27 +02:00
Tasuku Nakagawa 36c829386b
Use an import instead of FQCN in StaxEventXMLReader
Closes gh-26875
2021-04-29 17:59:26 +02:00
Sébastien Deleuze d7f67b3dc3 Fix a typo in PropertyResolverExtensions documentation 2021-04-28 12:17:27 +02:00
Сергей Цыпанов db9a10bf35
Use String.startsWith() instead of substring() in PatternMatchUtils
Closes gh-26822
2021-04-21 13:56:38 +02:00
Sébastien Deleuze eca87b87de Improve Kotlin support in BridgeMethodResolver#findBridgedMethod
This commit adds support for Kotlin non-nullable type which resolves
to primitive Java types in BridgeMethodResolver#findBridgedMethod.

Closes gh-26585
2021-04-01 15:39:53 +02:00
Rossen Stoyanchev 5e1e29a2dd Fix failing tests
See gh-26746
2021-03-31 12:25:39 +01:00
Juergen Hoeller 5b227e5677 Upgrade to Objenesis 3.2
Closes gh-26714
2021-03-22 23:11:30 +01:00
Stephane Nicoll 12f8cdd715 Update copyright year of changed files
See gh-26673
2021-03-13 18:03:26 +01:00
Rebwon 2daefedf5e Polish
See gh-26673
2021-03-13 18:02:54 +01:00
Juergen Hoeller 01bf1c9021 Polishing 2021-03-09 00:08:03 +01:00
Juergen Hoeller 530fb0808d Polishing 2021-03-08 23:45:56 +01:00
Qimiao Chen 75b6540bd8 Specify 20 to the initial size of the ArrayList 2021-03-08 18:56:22 +01:00
Juergen Hoeller b5147a034c Polishing
See gh-26574
See gh-26575
2021-02-25 18:08:04 +01:00
Craig Andrews dee12db50a getResource can throw IllegalArgumentException
Class.getResource, ClassLoader.getResource, and ClassLoader.getSystemResource will throw IllegalArgumentException if a malformed URL is provided to them.

According to its javadoc, resolveURL should return null if not resolvable, so catch the IllegalArgumentException and return null.
2021-02-25 17:55:24 +01:00
Juergen Hoeller e53cce0778 Allow AOP proxies to be created using the original ClassLoader
Closes gh-26601
2021-02-25 17:48:01 +01:00
Rossen Stoyanchev 3ec0452fed Dedicated, "_"-prefixed log category for request mappings
Closes gh-26539
2021-02-24 09:36:43 +00:00
Johnny Lim dfc8406917
Polish contribution
See gh-26462
Closes gh-26586
2021-02-22 11:05:25 +01:00
Juergen Hoeller 9417975f66 Nullability refinements
See gh-26462
2021-02-16 08:51:42 +01:00
Juergen Hoeller f48c3d9b67 Document ASM version as 9.x (effectively 9.1 at present) 2021-02-16 00:09:10 +01:00
Stephane Nicoll 582559dd9e Polish "Allow customer resolver and property sources"
See gh-26462
2021-02-15 16:53:18 +01:00
Phillip Webb d4c609f2f0 Allow customer resolver and property sources
Add factory methods to `AbstractEnvironment` that allow a custom
`ConfigurablePropertyResolver` and `MutablePropertySources` instance
to be used.

See gh-26462
2021-02-15 16:53:18 +01:00
Sébastien Deleuze 3524401bf1 Introduce a NativeDetector utility class
With the introduction of the -H:+InlineBeforeAnalysis native image
compiler flag in GraalVM 21.0.0, it is now possible to use an utility method and get code
removal at build time.

This flag will be enabled as of Spring Native 0.9.0.

closes gh-25795
2021-02-15 16:36:23 +01:00
Stephane Nicoll 8807f94ad8 Polish "Allow bypass of active/default properties"
See gh-26461
2021-02-15 16:28:18 +01:00
Phillip Webb da3ff29e88 Allow bypass of active/default properties
Introduce protected methods that can be used to bypass or change the
way that active and default property values are read.

See gh-26461
2021-02-15 16:24:22 +01:00
Sam Brannen 566ff54782 Polishing
See gh-26540
2021-02-12 11:29:00 +01:00
Oleksandr Kravchuk 77b7e49fb2 Update ref docs for Inner class names
This commit updates the reference manual to point out that one may use
`.` instead of `$` as the nested class separator when providing a fully
qualified class name for a nested class in XML configuration.

This commit also updates the test for ClassUtils#forName to assert
support for `.` instead of `$`.

Closes gh-26540
2021-02-12 10:54:55 +01:00
Arjen Poutsma 9b0c2cca95 Ensure StringDecoder supports multiline delimiters
This commit makes sure the StringDecoder supports stripping off
multi-line delimiters, such as \r\n. Specifically, we ensure that the
delimiter is stripped from the joined buffer.

Closes gh-26511
2021-02-09 14:31:49 +01:00
Rossen Stoyanchev 0d16c9100a MIME types by Class for Encoder, Decoder, HttpMessageReader|Writer
Closes gh-26212
2021-02-04 16:12:57 +00:00
Sam Brannen ad8775ef95 Link to Objenesis property name constant in SpringProperties 2021-02-02 17:42:45 +01:00
Sam Brannen 8589804012 Link to known property name constants in SpringProperties 2021-02-02 15:20:41 +01:00
Sam Brannen 03f1b65084 Polish Javadoc for ResourceLoader APIs 2021-01-26 12:20:28 +01:00
Juergen Hoeller 799885fd6d Introduce public defineClass variant for SmartClassLoader implementations
Closes gh-26403
2021-01-19 12:03:18 +01:00
Sam Brannen b07a6b3283 Upgrade Shadow plugin to version 6.1.0 2021-01-12 12:27:54 +01:00
Sébastien Deleuze 3113917c55 Update ReactiveAdapterRegistry to do classpath checks during init
To improve GraalVM native image footprint and compatibility.

Closes gh-26295
2021-01-05 09:17:34 +01:00
Juergen Hoeller b0f404722e Upgrade to ASM master (including early support for Java 17 bytecode)
Closes gh-26307
2020-12-21 19:33:33 +01:00
Sam Brannen 1292947f78 Introduce computeAttribute() in AttributeAccessor
This commit introduces computeAttribute() as an interface default method
in the AttributeAccessor API. This serves as a convenience analogous to
the computeIfAbsent() method in java.util.Map.

Closes gh-26281
2020-12-15 22:47:02 +01:00
Rossen Stoyanchev ad42010785 Correlate data buffers to request log messages
HttpMessageWriter implementations now attach the request log prefix
as a hint to created data buffers when the logger associated with
the writer is at DEBUG level.

Closes gh-26230
2020-12-07 22:29:07 +00:00
Rossen Stoyanchev 8c1d06e0c4 Polishing contribution
Closes gh-25927
2020-12-03 17:16:27 +00:00
shevtsiv 01892c6524 Optimization in ResourceArrayPropertyEditor
The previous implementation uses ArrayList for storing resolved
resources and ArrayList has O(n) time complexity for the contains
operation. By switching to the HashSet for storing resolved
resources we improve the time complexity of this operation to be O(1).

See gh-25927
2020-12-03 17:16:27 +00:00
Juergen Hoeller 396fb0cd51 Support for multi-threaded addConverter calls
Closes gh-26183
2020-12-02 12:25:37 +01:00
Sam Brannen 77d6f8bc00 Polishing 2020-11-24 14:04:33 +01:00
Juergen Hoeller 42e492ef2a Polishing 2020-11-20 19:00:06 +01:00
Juergen Hoeller 4fb5d59c64 Declare resolvedCharset as transient (restoring serializability)
Closes gh-26127
2020-11-20 18:40:10 +01:00
Juergen Hoeller a7cce64e5d Add assertion check to FieldFilter.and(FieldFilter) method as well
See gh-26121
2020-11-19 21:05:24 +01:00
Juergen Hoeller a0544e78ea Replace early SpringProperties logger usage with System.err
Closes gh-26120
2020-11-19 18:47:31 +01:00
Сергей Цыпанов c92dccea1b Simplify XMLEventStreamWriter.writeEndElement() 2020-11-19 18:32:05 +01:00
Сергей Цыпанов 9ec96f6141 Fail MethodFilter.and() immediately when null is passed 2020-11-19 18:31:39 +01:00
Juergen Hoeller b29723623b Encode hash symbol in jar file path (for compatibility with JDK 11+)
Closes gh-26104
2020-11-17 14:45:45 +01:00
Marten Deinum c9b27af64f Reduce overhead of char[] creation
There are more locations which could benefit from not using a
toCharArray on a String, but rather use the charAt method from
the String itself. This to prevent an additional copy of the
char[] being created.
2020-11-17 11:57:09 +01:00
Juergen Hoeller 238354a081 Polishing 2020-11-16 17:42:22 +01:00
Rossen Stoyanchev b92d249f45 AntPathMatcher allows newline in URI template variables
Closes gh-23252
2020-11-12 22:00:47 +00:00
Rossen Stoyanchev 2b1f229998 LimitedDataBufferList adds or raises error
Closes gh-26060
2020-11-10 19:59:36 +00:00
Sam Brannen fc5e3c335f Introduce and() methods in MethodFilter & FieldFilter for composition
This commit introduces `and()` default methods in the MethodFilter and
FieldFilter functional interfaces in ReflectionUtils in order to simplify
uses cases that need to compose filter logic.

Closes gh-26063
2020-11-10 18:00:24 +01:00
Sébastien Deleuze c73cff8bad Use RxJava 2/3 fromPublisher() when possible in ReactiveAdapterRegistry
Closes gh-26051
2020-11-09 14:49:45 +01:00
Juergen Hoeller 079ca80854 SpEL supports record-style accessor methods as well
Closes gh-26029
2020-11-04 16:51:54 +01:00
Sam Brannen 0a0299693b Do not create intermediate list in MergedAnnotationCollectors.toAnnotationSet()
Prior to this commit, MergedAnnotationCollectors.toAnnotationSet()
created an intermediate ArrayList for storing the results prior to
creating a LinkedHashSet in the finishing step.

Since the creation of the intermediate list is unnecessary, this commit
simplifies the implementation of toAnnotationSet() by using the
Collector.of() factory method that does not accept a `finisher` argument.
The resulting Collector internally uses a `castingIdentity()` function
as the `finisher`.

Closes gh-26031
2020-11-04 14:19:58 +01:00
Sam Brannen d1e6883d5d Fix issues in Javadoc 2020-10-27 11:05:31 +01:00
Sam Brannen 705cf09ad7 Merge branch '5.2.x' 2020-10-26 15:05:35 +01:00
Sam Brannen 449377908f Fix JUnit 4 to AssertJ migration bugs
The migration from JUnit 4 assertions to AssertJ assertions resulted in
several unnecessary casts from int to long that actually cause
assertions to pass when they should otherwise fail.

This commit fixes all such bugs for the pattern `.isNotEqualTo((long)`.
2020-10-26 14:53:09 +01:00
Juergen Hoeller 82835b99ec Restore independent LinkedMultiValueMap implementation (without base class)
Closes gh-25960
2020-10-26 11:16:33 +01:00
Juergen Hoeller a3f3a136c4 Make MultiValueMapAdapter public (as base class for LinkedMultiValueMap)
Closes gh-25960
2020-10-26 10:41:59 +01:00
Juergen Hoeller 73eefeac5f Expose contains, remove and clear methods on ConcurrentLruCache
Closes gh-25963
2020-10-24 23:48:13 +02:00
Rossen Stoyanchev cf988f81b5 Merge branch '5.2.x' into master 2020-10-23 15:14:05 +01:00
Rossen Stoyanchev fb4363e4e0 Refactor DataBufferUtils Matcher implementation
The existing implementation was exposed to very poor performance when matching
with multiple delimiters against a large buffer with many delimiters. In that
case all matchers are invoked many times (as many as the number of delimiters)
even though some of them found no match at all on the first pass.

The revised implementation uses a single index and advances all matchers
together, checking one byte a time, and not letting any one of them search to
the end of the entire buffer on a single pass.

Closes gh-25915
2020-10-23 13:23:51 +01:00
Juergen Hoeller 1ec6843913 Upgrade CGLIB to ASM9 level as well
See gh-24872
2020-10-23 11:47:03 +02:00
Rossen Stoyanchev 784d72cc56 Fix checkstyle violations 2020-10-23 08:22:23 +01:00
Rossen Stoyanchev 9a1323aad5 Update StringDecoderBenchmark
See gh-25915
2020-10-22 21:50:27 +01:00
Rossen Stoyanchev eec6ec8f44 Merge branch '5.2.x' into master 2020-10-22 21:48:45 +01:00
Rossen Stoyanchev db9e0b0ccb Refactor StringDecoder
Simplify and optimize the processing of the input stream.

The existing implementation was using bufferUntil and creating a List
for every line along with an EndFrameBuffer inserted for the
bufferUntil predicate. So the larger the input buffer and the more
lines it contained, the greater the overhead.

The new implementation avoids bufferUntil for all lines and
instead uses concatMapIterable to aggregate the lines from a buffer
into a single list. So the larger the input buffer and the more
lines it contains, the better the throughput. The only buffering
used then is for partial chunks and those are accumulated in a list.

See gh-25915
2020-10-22 21:29:54 +01:00
Rossen Stoyanchev cfc3522641 Add jmh benchmark for StringDecoder
See gh-25915
2020-10-21 22:06:55 +01:00
Juergen Hoeller 621295dbd8 Deprecate StringUtils.isEmpty(Object) and replace remaining usage
Closes gh-25945
2020-10-21 16:09:26 +02:00
Juergen Hoeller 5ab1097b43 Consistent dependency declaration order 2020-10-16 15:19:25 +02:00
Juergen Hoeller f13c43bafe Consistent dependency declaration order 2020-10-16 12:22:04 +02:00
Rossen Stoyanchev 424e28bc35 Merge branch '5.2.x' into master 2020-10-15 17:18:33 +01:00
Rossen Stoyanchev c45b106d95 Fix race issue and improve readAsynchronousFileChannel
Before this commit, ReadCompletionHandler delayed closing the channel
to allow an ongoing read to complete/fail so we can get a hold of the
associated DataBuffer and release it. This can be problematic since the
read take time to complete but even more importantly there was a race
condition where we didn't check if we've been disposed concurrently
while releasing the read flag.

This commit removes the delay and closes the channel immediately from
cancel() and that should in turn fail any ongoing read operation,
according to AsynchronousChannel, and the DataBuffer is released.

Further improvements include:
- combining the "reading" and "disposed" AtomicBoolean's into a
single "state" AtomicReference.
- an optimistic check to remain in READING mode and avoid state
switches when there is demand to continue reading.

Closes gh-25831
2020-10-15 17:10:22 +01:00
Sébastien Deleuze 33fcba55d1 Disable KotlinPropertyResolverExtensionsTests for now
Those tests produce intermittent build errors.
2020-10-13 16:19:01 +02:00
Sébastien Deleuze 3ed8813bbf Upgrade to Coroutines 1.4.0-M1 and use awaitSingle()
This commit raises the minimum Coroutines version supported
to 1.4.0-M1 and above, and changes usages of awaitFirst() or
awaitFirstOrNull() to awaitSingle() or awaitSingleOrNull()
to fix gh-25007.

Closes gh-25914
Closes gh-25007
2020-10-13 15:26:39 +02:00
Juergen Hoeller 7f365942a5 Nullability refinements and related polishing 2020-10-13 00:08:15 +02:00
Juergen Hoeller ca2b412905 Merge branch '5.2.x' 2020-10-12 18:36:35 +02:00
Juergen Hoeller 66a67ec807 Polishing 2020-10-12 18:26:14 +02:00
Juergen Hoeller 21f2863d8e ControllerAdvice resolution detects @Order declared on @Bean method as well
Closes gh-25872
2020-10-12 18:07:17 +02:00
Juergen Hoeller 2a34c0ea70 Return early from composed Converter if initial conversion step returned null
See gh-23379
2020-10-12 18:07:17 +02:00
Rossen Stoyanchev b9f7b0d955 Upgrade to Reactor 2020.0-RC2
See gh-25884
2020-10-12 14:26:51 +01:00
Rossen Stoyanchev e73e489fd8 Remove use of MonoProcessor.fromSinks
See gh-25884
2020-10-09 20:46:21 +01:00
Sébastien Deleuze 94a42a3086 Support suspending handler methods in Spring MVC
This commit adds support for Kotlin Coroutines suspending functions to
Spring MVC, by converting those to a Mono that can then be handled by
the asynchronous request processing feature.

It also optimizes Coroutines detection with the introduction of an
optimized KotlinDetector.isSuspendingFunction() method that does not
require kotlin-reflect.

Closes gh-23611
2020-10-09 12:25:32 +02:00
Juergen Hoeller d55c5b30d7 Merge branch '5.2.x' 2020-10-07 15:34:57 +02:00
Juergen Hoeller ec9de943ee Construct StringBuilder in StreamUtils with appropriate initial size
Closes gh-25789
2020-10-07 15:11:53 +02:00
Philippe Marschall cf61545f41 Add Dependencies Manifest Entry to spring-core
Add a Dependencies manifest entry with the value jdk.unsupported to
spring-core.
2020-10-06 15:45:49 +02:00
Сергей Цыпанов 8a04910bdd Drop explicit zeroing at instantiation of Atomic* objects 2020-10-06 15:45:12 +02:00
Juergen Hoeller b7e1553c9d Merge branch '5.2.x'
# Conflicts:
#	build.gradle
#	spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBuilder.java
2020-10-06 15:37:54 +02:00
Juergen Hoeller 1745a3f25d Consistent @Nullable declarations on overridden converter methods 2020-10-06 15:31:26 +02: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
Juergen Hoeller 6c631e3d5c Merge branch '5.2.x'
# Conflicts:
#	spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java
2020-09-25 11:36:18 +02:00
Juergen Hoeller 6e4fcb69f0 Polishing 2020-09-25 11:26:01 +02:00
Juergen Hoeller c04400890f Avoid repeated Charset resolution in MimeType
Closes gh-25808
2020-09-25 11:23:12 +02:00
Juergen Hoeller 9795883d91 Avoid repeated Charset resolution in MimeType
Closes gh-25808
2020-09-25 10:51:08 +02:00
Shenker93 ad5072a43c optimize StringUtils trimLeadingWhitespace() / trimTrailingWhitespace() & trimLeadingCharacter() / trimTrailingCharacter() utility methods 2020-09-25 10:44:02 +02:00
Juergen Hoeller 2a74f20c99 Merge branch '5.2.x' 2020-09-18 19:14:57 +02:00
Juergen Hoeller f5d7161d6b Consistent flushing of given OutputStream 2020-09-18 19:14:11 +02:00
Juergen Hoeller 82e64af5a5 Avoid throwing plain RuntimeException (plus related polishing)
See gh-24805
2020-09-18 19:01:49 +02:00
Juergen Hoeller bbe74635eb Merge branch '5.2.x' 2020-09-18 18:16:33 +02:00
Juergen Hoeller 9dfef59af2 Construct StringWriter instances with appropriate initial size
Closes gh-25789
2020-09-18 18:14:57 +02:00
Sam Brannen 9c8a8d82b9 Merge branch '5.2.x' 2020-09-15 17:18:39 +02:00
Sam Brannen a6daed1b71 Fix example in Javadoc for Assert.notNull(object, messageSupplier)
Closes gh-25774
2020-09-15 16:27:21 +02:00
Sam Brannen fe9f29f031 Suppress deprecation warning in AbstractDataBufferAllocatingTests 2020-09-15 14:34:41 +02:00
Rossen Stoyanchev 8b8b59bf80 Merge branch '5.2.x' into master 2020-09-15 11:37:00 +01:00
Rossen Stoyanchev 28df426798 Update AbstractDataBufferAllocatingTests
We are passing custom values to the constructor of PooledByteBufAllocator in
tests in order to turn of caching. This is based on:
https://github.com/netty/netty/issues/5275#issuecomment-220547057

Netty 4.1.52 has significant changes in PooledByteBufAllocator:
https://github.com/netty/netty/pull/10267

After the changes, our current value for maxOrder=2, which results in
chunkSize=16K, causes an assert failure in PoolChunk where the runSize
exceeds the chunkSize.
2020-09-15 11:31:59 +01:00
Juergen Hoeller 07b3e92bae Merge branch '5.2.x'
# Conflicts:
#	build.gradle
#	src/docs/asciidoc/core/core-aop-api.adoc
2020-09-14 22:22:02 +02:00
Juergen Hoeller 3c84863271 Polishing 2020-09-14 22:18:30 +02:00
Rossen Stoyanchev bd277819fd Merge branch '5.2.x' into master 2020-09-14 15:43:38 +01:00
Rossen Stoyanchev dccc78146a Expose defaultCharset in StringDecoder
Closes gh-25762
2020-09-14 14:28:02 +01:00
Rossen Stoyanchev 3295034839 Merge branch '5.2.x' into master 2020-09-13 21:30:02 +01:00
Rossen Stoyanchev 49356b2c0f SimpleIdGenerator rolls over at Long.MAX_VALUE
Closes gh-25485
2020-09-13 21:09:08 +01:00
Juergen Hoeller a958633b7a Merge branch '5.2.x' 2020-09-08 17:09:58 +02:00
Juergen Hoeller 4d1d60ac42 Check log level before delegating Supplier-based message to target Log
Closes gh-25741
2020-09-08 16:50:40 +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
Juergen Hoeller 7dbb40ffa0 Merge branch '5.2.x' 2020-09-08 12:24:18 +02:00
Juergen Hoeller c6cc6705ef FileUrlResource.isWritable() exclusively relies on getFile() implementation
Closes gh-25584
2020-09-08 12:23:27 +02:00
Juergen Hoeller a93af329fc Fix javadoc typos (from ASM master)
See gh-24872
2020-09-07 17:55:41 +02:00
Juergen Hoeller 75f394ca85 Merge branch '5.2.x' 2020-09-07 17:54:51 +02:00
Juergen Hoeller 613b05d814 Properties loading with ignoreResourceNotFound covers SocketException as well
Closes gh-25717
2020-09-07 17:51:14 +02:00
Yanming Zhou a2bb59f1b8 Replace StringBuffer with StringBuilder where possible 2020-09-03 22:40:51 +02:00
Brian Clozel 88249b2d9a Polish StartupStep "tags" method
Renaming the `tags` method to `getTags` for overall consistency, and
fixing the Javadoc to mention that this returns an immutable collection.

Closes gh-25678
2020-09-02 17:57:38 +02:00
Stephane Nicoll f55b48f4b4 Merge branch '5.2.x' 2020-09-02 14:44:22 +02:00
Stephane Nicoll c2363a6ef9 Make DataSize serializable
Closes gh-25675
2020-09-02 14:39:12 +02:00
Сергей Цыпанов 1f3e52d932 gh-25650 Replace remaining usage of LinkedList with ArrayList in tests 2020-08-31 14:33:14 +02:00
Сергей Цыпанов a033660425 Improve performance of JdkDynamicAopProxy.getProxy() 2020-08-30 11:40:08 +02:00
Juergen Hoeller 2080878d82 Merge branch '5.2.x'
# Conflicts:
#	spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java
2020-08-27 14:40:54 +02:00
Juergen Hoeller 589060d10f Avoid LinkedList performance issues through use of ArrayDeque
Closes gh-25652
2020-08-27 14:14:08 +02:00
Juergen Hoeller 874574513c Replace remaining usage of LinkedList with ArrayList/ArrayDeque
Closes gh-25650
2020-08-26 18:32:08 +02:00
Juergen Hoeller d198c4426f Extract ConcurrentLruCache for reuse in NamedParameterJdbcTemplate
Closes gh-24197
2020-08-26 14:35:01 +02:00
Juergen Hoeller 2b47e779ac Explicit explanation that no resize/rehash operations will be needed
See gh-25349
2020-08-26 11:48:50 +02:00
Juergen Hoeller ff11467a0c Avoid resizing of fixed-size HashMap/LinkedHashMap variants
Closes gh-25349
2020-08-25 19:26:18 +02:00
Juergen Hoeller 7324140d20 Merge branch '5.2.x' 2020-08-25 16:21:00 +02:00
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
Juergen Hoeller 6ea7ff1c6d Upgrade to ASM master (8.1 beta)
Closes gh-24872
2020-06-17 10:56:40 +02:00
Сергей Цыпанов 7949937655 Remove redundant assignment of default values to volatile fields 2020-06-17 10:50:51 +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
Sam Brannen 94d7462891 Ensure spring-core JAR is reproducible
Prior to this commit, a change to Javadoc in any class in spring-core
would result in ALL tests in the entire test suite being re-run via the
Gradle build.

Thanks to a tip from @melix, this commit aims to ensure that the
spring-core JAR is "reproducible".
2020-06-13 14:53:06 +02:00
Sam Brannen 3f7e86eadd Update Javadoc for Assert regarding Guava Preconditions 2020-06-13 14:53:06 +02:00
Sam Brannen 50a0094a47 Ensure spring-core JAR is reproducible
Prior to this commit, a change to Javadoc in any class in spring-core
would result in ALL tests in the entire test suite being re-run via the
Gradle build.

Thanks to a tip from @melix, this commit ensures that the spring-core
JAR is "reproducible".
2020-06-13 14:36:27 +02:00
Sam Brannen d9969d1e4d Update Javadoc for Assert regarding Guava Preconditions 2020-06-12 09:49:47 +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
Juergen Hoeller 663f2e8afd Merge branch '5.2.x' 2020-06-10 22:53:06 +02:00
Juergen Hoeller ae1ed9d458 Document exception handling limitations in TaskDecorator implementations
Closes gh-25231
2020-06-10 22:52:01 +02:00
Rossen Stoyanchev 1984cfe9d7 Merge branch '5.2.x' 2020-06-08 21:20:44 +01:00
Rossen Stoyanchev a2d516d526 Replace "whitelist" with alternative words 2020-06-08 21:19:28 +01:00
Juergen Hoeller 65b09be669 Polishing 2020-06-06 16:10:20 +02:00
Sam Brannen da7ead8914 Polishing 2020-06-03 15:05:58 +02:00
Juergen Hoeller e955e52f2f Refactor method name dispatching to switch statements
Closes gh-25163
2020-05-29 23:07:25 +02:00
Juergen Hoeller 42ff01b5aa Merge branch '5.2.x' 2020-05-29 15:57:32 +02:00
Juergen Hoeller 914425eefa Polishing 2020-05-29 15:52:39 +02:00
Juergen Hoeller ef626e992d Document that MapPropertySource should not contain null values
Closes gh-25142
2020-05-29 15:49:36 +02:00
Juergen Hoeller bec89dba4c Consistent MultiValueMap behavior for empty list values
This commit extracts MultiValueMapAdapter from CollectionUtils and reuses its implementation as base class of LinkedMultiValueMap.

Closes gh-25140
2020-05-29 15:48:19 +02:00
Juergen Hoeller 27d5fdc5aa Polishing 2020-05-26 23:35:38 +02:00
Sam Brannen a853a58c62 Avoid duplicate addition of void.class in ClassUtils
This commit avoids duplicate addition of void.class to the temporary
primitiveTypes Set in the static initialization block in ClassUtils.

Closes gh-25128
2020-05-26 11:19:33 +02:00
Juergen Hoeller 399453d9f1 Merge branch '5.2.x'
# Conflicts:
#	spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateQueryTests.java
#	spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplateTests.java
2020-05-22 17:16:09 +02:00
Juergen Hoeller d7161f5e5e Polishing 2020-05-22 16:23:46 +02:00
Juergen Hoeller e5c079edfc Introduce serializeToByteArray/deserializeFromByteArray on (De)Serializer
Closes gh-25117
2020-05-22 16:22:59 +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
Juergen Hoeller 26c205589b Merge branch '5.2.x'
# Conflicts:
#	build.gradle
#	spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java
#	spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationInterceptor.java
2020-05-14 00:33:37 +02:00
Juergen Hoeller fe33822fa7 Polishing 2020-05-14 00:23:20 +02:00
Juergen Hoeller 8212aaf3bb ResolvableType ignores TypeNotPresentException from generic signature
Closes gh-25064
2020-05-14 00:22:58 +02:00
Brian Clozel 612a63c0f1 Optimize MediaType parsing
Prior to this commit, `MediaType.parseMediaType` would already rely on
the internal LRU cache in `MimeTypeUtils` for better performance. With
that optimization, the parsing of raw media types is skipped for cached
elements.
But still, `MediaType.parseMediaType` would first get a cached
`MimeType` instance from that cache and then instantiate a
`new MediaType(type, subtype, parameters)`. This constructor not only
replays the `MimeType` checks on type/subtyme tokens and parameters, but
it also performs `MediaType`-specific checks on parameters.
Such checks are not required, as we're using an existing `MimeType`
instance in the first place.

This commit adds a new protected copy constructor (skipping checks) in
`MimeType` and uses it in `MediaType.parseMediaType` as a result.

This yields interesting performance improvements, with +400% throughput
and -40% allocation/call in benchmarks. This commit also introduces a
new JMH benchmark for future optimization work.

Closes gh-24769
2020-05-13 21:36:06 +02:00
Rossen Stoyanchev a64e7091e0 Deprecate support for RxJava 1.x
Closes gh-19628
2020-05-11 08:48:48 +01: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
Sam Brannen b1c1a232ca Upgrade to Gradle 6.4
Closes gh-25020
2020-05-06 14:25:41 +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 5abca033d0 Revise duplicate filtering in SpringFactoriesLoader
This commit ensures that the static cache in SpringFactoriesLoader
contains unmodifiable lists of unique names of factory implementations.

See gh-24985
2020-04-29 14:05:14 +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
Jendrik Johannes 9bd60f6554 Update to Gradle 6.2
- Build Scan plugin is now Gradle Enterprise plugin applied in settings
- Compile task dependencies are now defined through classpath
- Test fixture publication can be disabled through public API

Closes gh-24384
2020-04-28 15:03:03 +02:00
Juergen Hoeller cdadb834b0 Redefine DefaultResourceLoader default constructor for late TCCL access
Closes gh-24957
2020-04-28 13:02:39 +02:00
Juergen Hoeller 73fadd8b7c Polishing 2020-04-27 11:45:41 +02:00
Sam Brannen 59ecd4997c Optimize toString() for synthesized annotations
This commit moves the toString() implementation for synthesized
annotations from TypeMappedAnnotation to
SynthesizedMergedAnnotationInvocationHandler in order to take advantage
of the synthesized annotation attribute value cache introduced in
72b1abd226.

Closes gh-24970
2020-04-26 14:14:07 +02:00
Sam Brannen db45b80b1f Suppress warnings for deprecated AnnotationFilter.NONE enum constant
See gh-24932
2020-04-26 13:58:31 +02:00
Juergen Hoeller ad088f2157 Polishing 2020-04-25 17:59:04 +02:00
Juergen Hoeller af65b1ca62 Polishing 2020-04-25 16:37:16 +02:00
Juergen Hoeller e5a292fb34 Deprecate AnnotationFilter.NONE and document MergedAnnotations design
Closes gh-24932
2020-04-25 16:36:44 +02:00
Сергей Цыпанов bff1a1932f Rid pointless wrapping with BufferedInputStream from class reading 2020-04-25 16:27:01 +02:00
Sam Brannen 72b1abd226 Reintroduce synthesized annotation attribute value caching
Prior to the introduction of the MergedAnnotation API in Spring Framework
5.2, our SynthesizedAnnotationInvocationHandler utilized a cache for
annotation attribute values; whereas, the new
SynthesizedMergedAnnotationInvocationHandler has no such caching in
place.

Issues such as gh-24961 indicate a regression in performance caused by
the lack of such an attribute value cache. For example, the required
attribute in @RequestParam is looked up using the internal meta-model
in the MergedAnnotation API twice per request for each @RequestParam in
a given controller handler method.

This commit reintroduces the attribute value cache to avoid the
unnecessary performance overhead associated with multiple lookups of
the same attribute in a synthesized annotation. This applies not only
to direct attribute method invocations but also to invocations of
equals() and hashCode() on a synthesized annotation.

Note, however, that this commit does NOT address multiple lookups of
annotation attribute values for invocations of toString(). That behavior
currently remains unchanged in the implementation of
org.springframework.core.annotation.TypeMappedAnnotation.toString().

Closes gh-24970
2020-04-25 15:28:09 +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 5721c747b2 Polishing 2020-04-21 18:47:28 +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
Rossen Stoyanchev 4b85b44bbd Update Javadoc of InputStreamResource#contentLength
Closes gh-20990
2020-04-20 12:53:42 +01:00
Sébastien Deleuze 6d5080825c Remove potentially confusing kotlin-reflect related log message
Closes gh-24935
2020-04-20 11:00:29 +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
Mikael d6c9c7d642
Simplify substring() usage in MimeTypeUtils
Closes gh-24933
2020-04-19 17:39:06 +02:00
Sam Brannen 3dadcaeb2d Polishing 2020-04-17 19:07:49 +02:00
Johnny Lim 87fa2c3b97
Avoid unnecessary String instantiation in StringUtils.deleteAny()
This commit avoids unnecessary String instantiation in
StringUtils.deleteAny() if nothing was deleted from the
input string.

Closes gh-24924
2020-04-17 18:44:16 +02:00
Brian Clozel 39536acf9f Fix potential leak in MimeTypeUtils LRUCache
Prior to this commit, the `MimeTypeUtils` LRUCache would maintain a
queue to track least recently used cached values. In some cases,
concurrent access could create more entries in that unbounded queue than
expected and spend a significant amount of time removing entries in that
queue (i.e. iterating over a long list of elements).

This commit ensures that recently used entries are only added to the
queue if they've been removed by the current thread, in case of
concurrent access.

Fixes gh-24886
2020-04-09 15:38:01 +02:00
Сергей Цыпанов e1951a098b Improve performance of StringUtils.deleteAny() 2020-04-09 11:36:32 +02:00
Sam Brannen 8c0aaf4863 Delete meaningless "performance" test
The test deleted in this commit didn't even assert anything to begin
with.

See gh-24830
2020-04-08 15:21:32 +02:00
Juergen Hoeller 8595f01e44 Polishing 2020-04-03 21:08:45 +02:00
Moran Avigdor 7d5e474e0d Recursively copy directory with symbolic link
The following modification will also recursively traverse the directory that the symbolic link points to.
This modification is not proposed for deleteRecursively, since it can be harmful if not intended.

This modification relates to the following commit:
Consistent use of NIO.2 for file read/write interactions
Issue: SPR-15748
12114a9
2020-04-03 21:05:26 +02:00
Sam Brannen e26764d249 Remove duplicate words in documentation and polish Javadoc 2020-03-31 12:17:58 +02:00
Sam Brannen ee42e3e730 Polish StreamUtils 2020-03-30 13:57:09 +02:00
Sam Brannen 9e30620ac2 Polish contribution
See gh-24805
2020-03-30 13:47:00 +02:00
Сергей Цыпанов e63d1cf12d Improve usage of ByteArrayOutputStream/ByteArrayInputStream
Closes gh-24805
2020-03-30 13:22:21 +02:00
Qimiao Chen f8ff4e42b9
Use try-with-resource to close resources
Closes gh-24807
2020-03-30 12:05:29 +02:00
Qimiao Chen 7c831d2ef4
Replace anonymous inner classes with lambdas in tests
Closes gh-24808
2020-03-30 12:02:23 +02:00
Rossen Stoyanchev 3175f0771e Remove dumpString from DataBufferTestUtils
See gh-24786
2020-03-26 21:42:12 +00:00
Rossen Stoyanchev 7aa06b8610 Polishing contribution
See gh-24786
2020-03-26 21:42:12 +00:00
Сергей Цыпанов f17b0125ff Simplify conversion of DataBuffer to String
See gh-24786
2020-03-26 21:42:12 +00:00
Juergen Hoeller 593a2ade91 Expose context class for interface-based CGLIB proxies as well
Closes gh-24657
2020-03-26 17:30:37 +01:00
Sam Brannen 6222efc54b Polish contribution
See gh-24785
2020-03-26 16:52:24 +01:00
Сергей Цыпанов 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