Commit Graph

1650 Commits

Author SHA1 Message Date
Rossen Stoyanchev 900bc8a2e3 Logging improvements for WebFlux
Issue: SPR-16898
2018-06-22 22:44:24 -04:00
Sam Brannen cafb5033e2 Polishing 2018-06-19 13:50:13 +03:00
Sam Brannen bea0e399b8 Polish profile expression support
Issue: SPR-12458
2018-06-17 00:15:18 +03:00
Sam Brannen 4184ebe799 Polish profile expression support
Issue: SPR-12458
2018-06-16 21:40:22 +03:00
Juergen Hoeller 38f9a7b072 FileSystemResource supports java.nio.file.Path based setup
Issue: SPR-16833
2018-06-15 22:12:14 +02:00
Juergen Hoeller bb6ab5dc91 OS-independent alphabetical sorting of directory content
Issue: SPR-16838
2018-06-15 22:09:29 +02:00
Stephane Nicoll 1f3b4f1863 Polish "Add profile expression support"
Issue: SPR-12458
2018-06-15 16:01:16 +02:00
Phillip Webb e2623b7d35 Add profile expression support
Allow the `Environment` to accept a generic `Profiles` interface which
can support more complex matching rules. The previous
`acceptsProfiles(String...)` method now uses `Profiles.of` which
supports basic profile expressions such as "(a | b) & !c"

Issue: SPR-12458
2018-06-15 16:01:16 +02:00
Juergen Hoeller c38cb43527 MethodParameter strictly asserts parameter index -1 for return type
Issue: SPR-16889
2018-06-14 00:42:19 +02:00
Rossen Stoyanchev 0078f46779 Use reflection for JdkFlowAdapter
To avoid compiler issues on Eclipse.
2018-06-13 09:38:54 -04:00
Juergen Hoeller 0777a80efe Polishing
(cherry picked from commit a2765c0)
2018-06-11 19:17:57 +02:00
Brian Clozel 417354da8a Remove dependency management noise from POMs
Prior to this commit, the generated POMs for Spring Framework modules
would contain unneeded/harmful information from the Spring Framework
build:

1. The BOM imports applied to each module by the dependency
management plugin, for example for Netty or Reactor Netty.
Spring should not export that opinion to its POMs.

2. The exclusion of "org.slf4:jcl-over-slf4j" from *all* dependencies,
which made the POMs much larger than necessary and suggested to
developers that they should exclude it as well when using all those
listed dependencies. In fact, only Apache Tiles currently brings that
transitively.

This commit removes that information from the POMs.
The dependencyManagement Gradle plugin is disabled for POM generation
and we manually resolve the dependency versions during the generation
phase.
The Gradle build is streamlined to exclude "org.slf4:jcl-over-slf4j"
only when necessary.

Issue: SPR-16893
2018-06-11 15:57:54 +02:00
Juergen Hoeller b790bd1fd6 LinkedCaseInsensitiveMap explicitly implements put/computeIfAbsent
Issue: SPR-16926
2018-06-11 14:10:12 +02:00
Yun 28e402bc76 Prevent instantiation of AnnotatedElementUtils
Closes gh-1848
2018-06-11 08:32:03 +02:00
Rossen Stoyanchev 010352163b Eliminate the need for Encoder#getContentLength
Issue: SPR-16892
2018-06-04 15:48:47 -04:00
Sebastien Deleuze a7a29a8226 Revisit PropertyResolver Kotlin extensions
Issue: SPR-16883
2018-05-31 12:20:37 +02:00
Juergen Hoeller 616a40adb6 ClassPathResource.isReadable() returns false for content length 0
Issue: SPR-16832
2018-05-29 22:31:47 +02:00
Juergen Hoeller 74fcdea2d9 SimpleAliasRegistry logs info message for alias overriding
Issue: SPR-16871
2018-05-29 21:51:33 +02:00
Juergen Hoeller 46a89d9534 Restore lenient null return value for ConditionContext.getBeanFactory()
Includes nullable return value for getClassLoader() with corresponding notes in applicable javadoc.

Issue: SPR-16866
2018-05-29 21:51:06 +02:00
Juergen Hoeller 69f14a2038 ClassPathResource.isReadable() checks InputStream (for jar directories)
Resource.isReadable() is defined to semantically imply exists() now.

Issue: SPR-16832
2018-05-29 21:47:33 +02:00
Sebastien Deleuze 406f6ec74d Fix PropertyResolverExtensions.kt location 2018-05-28 15:51:22 +02:00
Juergen Hoeller 836a09d5c0 Upgrade to Woodstox 5.1, XMLUnit 2.6, Gson 2.8.5 2018-05-25 00:18:06 +02:00
Rossen Stoyanchev d58888777f Polish ReactiveAdapterRegisry 2018-05-18 21:32:46 -04:00
Sebastien Deleuze 2c85be333c Filter synthetic in ReflectionUtils#USER_DECLARED_METHODS
Issue: SPR-16823
2018-05-15 14:58:50 +02:00
Oleksandr Hasheniuk 6545cab42c Improve performance of StringUtils#trimWhitespace
Issue: SPR-16766
2018-05-01 11:16:34 +02:00
nkjackzhang fb0e3e9356 Fix a typo in @Nullable Javadoc 2018-04-18 11:53:09 +02:00
Juergen Hoeller 2f4010e8d3 Correctly delegate to OrderUtils.getPriority for DecoratingProxy
Issue: SPR-16739
2018-04-17 23:37:42 +02:00
Juergen Hoeller d78e27f1e9 Avoid repeated superclass introspection in findAnnotation(Method,...)
Issue: SPR-16730
2018-04-17 16:44:28 +02:00
Juergen Hoeller 51be8a7303 Workaround for generic parameter types on inner class constructors
Issue: SPR-16734
2018-04-17 14:32:54 +02:00
Juergen Hoeller 0754833b37 Local XMLUnit dependency declarations with consistent version 2.5.1 2018-04-14 21:03:20 +02:00
Juergen Hoeller b95e05db04 AspectJExpressionPointcut consistently resolves superinterface methods
Includes efficient check for same ClassLoader in ClassUtils.isVisible, efficient MethodMatchers check for IntroductionAwareMethodMatcher, and supertype method resolution in MethodMapTransactionAttributeSource.

Issue: SPR-16723
2018-04-14 15:10:05 +02:00
Juergen Hoeller 0efa7a05ad ClassUtils.isCacheSafe delegates to isVisible for resolving classes
Issue: SPR-16714
2018-04-12 20:55:26 +02:00
Juergen Hoeller 46e3a919fe Cache-safety check for sibling loaders resolving the same classes
Issue: SPR-16714
2018-04-12 18:50:32 +02:00
Andreas Asplund 6a34ca24ce Restore org.springframework.cglib.core.KeyFactoryCustomizer.class
Issue: SPR-15859
2018-04-11 15:41:40 +02:00
Juergen Hoeller da80502ea6 AnnotationUtils.getAnnotation non-null check for synthesizeAnnotation
Issue: SPR-16708
2018-04-11 12:50:27 +02:00
Juergen Hoeller 61c3db0869 MethodHandles.Lookup.defineClass for CGLIB class definition purposes
Spring's CGLIB fork is patched with local copies of affected files here, introducing the notion of a "contextClass" (e.g. the proxy superclass) which gets passed through to ReflectUtils.defineClass for delegating to MethodHandles.Lookup.defineClass eventually, against a privateLookupIn(contextClass) lookup context on JDK 9/10/11.

Issue: SPR-15859
2018-04-11 12:47:55 +02:00
Sam Brannen 8874427cf4 Clean up warnings in spring-core 2018-04-10 13:10:58 +02:00
Juergen Hoeller 5d0700b936 AnnotationUtils.annotatedInterfaceCache available as deprecated field
Issue: SPR-16675
2018-04-03 12:21:03 +02:00
Juergen Hoeller 6102715b8d Consistent treatment of proxy classes and interfaces for introspection
Issue: SPR-16675
Issue: SPR-16677
2018-04-03 02:42:41 +02:00
Juergen Hoeller cc379f1cc7 Polishing 2018-04-01 12:57:19 +02:00
Juergen Hoeller 912c270f2b Polishing 2018-03-31 17:49:21 +02:00
Juergen Hoeller 129c05bcff Comprehensively cache annotated methods for interfaces and superclasses
Issue: SPR-16675
2018-03-31 15:12:02 +02:00
Juergen Hoeller 4da27c2a73 Avoid unnecessary introspection on methods and meta-annotations
Issue: SPR-16667
2018-03-31 00:18:14 +02:00
Kazuki MATSUDA d232fffa63 Use whenComplete since (null) return value not needed 2018-03-30 11:07:46 -04:00
Juergen Hoeller 22a8a668c9 AnnotationTypeFilter assumes no custom annotations on common Java types
Issue: SPR-16667
2018-03-30 15:31:43 +02:00
Juergen Hoeller 7a8d41e5d6 Extended set of common classes and language interfaces in ClassUtils
Issue: SPR-16667
2018-03-30 13:41:22 +02:00
Sam Brannen a6c45f0cd9 Polishing 2018-03-30 11:45:28 +02:00
Juergen Hoeller d553ddc5b3 Nullability refinements (based on IntelliJ IDEA 2018.1 introspection)
Issue: SPR-15756
2018-03-29 23:50:17 +02:00
Sam Brannen 17703e5dde Polishing 2018-03-29 17:45:55 +02:00
Sam Brannen 7c28152c13 Introduce ClassUtils.isInnerClass() utility method 2018-03-29 17:45:25 +02:00
Juergen Hoeller b165475eb6 Polishing 2018-03-29 16:05:52 +02:00
Juergen Hoeller 08dad4e3ac Consistent references to primitive types (in alphabetical order) 2018-03-29 16:05:00 +02:00
Juergen Hoeller 53d01392d7 Workaround for inner class constructor parameter annotation bug in javac
Issue: SPR-16652
2018-03-29 15:45:02 +02:00
Juergen Hoeller 3ac46da22f Correct description for doWithLocalFields
Issue: SPR-16658
2018-03-29 15:42:30 +02:00
Sam Brannen 4b9e3a9211 Introduce failing test for SPR-16652
This commit introduces tests for looking up annotations on parameters
in constructors for nested and inner classes via Spring's
MethodParameter abstraction.

The test for an inner class is currently disabled since it fails on
JDK 8. See JIRA issue for details.

Issue: SPR-16652
2018-03-28 17:42:55 +02:00
Juergen Hoeller b2d87abcbb Polishing 2018-03-28 12:06:38 +02:00
Rossen Stoyanchev e00384a6fd MimeTypeUtils trims parameter names / values
Issue: SPR-16630
2018-03-27 19:56:09 -04:00
Juergen Hoeller e3d0ef6015 Use Map.forEach instead of manual Map.Entry iteration wherever possible
Issue: SPR-16646
2018-03-27 00:38:32 +02:00
Rossen Stoyanchev ab2410c754 MimeTypeUtils uses SecureRandom
The prevailing current wisdom is to use the default constructor for
secure and let it pick the best algorithm for the OS.

On Java 8 (Oracle), Linux this results in "NativePRNG" which uses
/dev/random (potentially blocking) for the initial seed, and
/dev/urandom (non-blocking) for subsequent calls to nextInt.

Issue: SPR-16635
2018-03-23 21:45:41 -04:00
Juergen Hoeller f00afe3247 Use (Concurrent)Map.computeIfAbsent for lazy nested collection creation 2018-03-23 17:36:23 +01:00
Rossen Stoyanchev 94c525cdc8 Polish @RequestPart support 2018-03-21 18:26:13 -04:00
Rossen Stoyanchev 2ff35daf9b Add test case based on SPR-16615 2018-03-19 13:32:10 -04:00
Rossen Stoyanchev 30583a62cf Fix Class isAssignableFrom checks for Resource conversion
Issue: SPR-16606
2018-03-16 16:18:05 -04:00
Juergen Hoeller 356ef45e99 ConcurrentReferenceHashMap properly handles getOrDefault for null values
Issue: SPR-16584
2018-03-14 17:17:04 +01:00
Juergen Hoeller 967a2ef2d2 Validate Class attributes as well as Class array attributes
Issue: SPR-16564
2018-03-12 20:41:44 +01:00
Juergen Hoeller 50e980c02f Validate declared annotations before deciding between reflection and ASM
Issue: SPR-16564
2018-03-12 13:40:26 +01:00
Juergen Hoeller 1b1a69a144 SimpleAliasRegistry fully synchronizes registerAlias and removeAlias
Issue: SPR-16577
2018-03-12 13:27:48 +01:00
Sam Brannen 42b4f6e1ff Clean up warnings and dead code in spring-core module 2018-03-11 14:13:30 +01:00
igor-suhorukov 0c45c4c6a3 lamdbas containing only one statement should not nest this statement in a block 2018-03-08 21:49:04 +01:00
Juergen Hoeller 139dc1d373 Polishing (collapsed if checks, consistent downcasts, refined javadoc) 2018-03-08 18:11:57 +01:00
igor-suhorukov 0f7485b01d Polish: reorder the modifiers to comply with the Java Language Specification. 2018-03-08 17:57:47 +01:00
Rossen Stoyanchev 27815847b1 content-length support in EncoderHttpMessageWriter
EncoderHttpMessageWriter checks explicitly for Mono publishers and sets
the content length, if it is known for the given data item.

Issue: SPR-16542
2018-03-06 19:04:02 -05:00
Juergen Hoeller eb9c43dcbc Reliably expose nested cause exception message for PersistenceException
Issue: SPR-16559
2018-03-06 23:06:14 +01:00
Juergen Hoeller c543368aad Polishing 2018-03-03 17:33:48 +01:00
Juergen Hoeller cd4f0935c5 Revised deprecation markers 2018-03-01 23:43:06 +01:00
igor-suhorukov 8080f56db8 Polish: "@Override" should be used on overriding and implementing methods 2018-03-01 00:15:18 +01:00
Juergen Hoeller 6663d0ff07 Support for ResolvableType.getType().getTypeName() on Java 8
Issue: SPR-16535
2018-02-26 17:19:12 +01:00
igor-suhorukov 49fd724d8f Polish: String function use should be optimized for single characters 2018-02-25 20:48:47 +01:00
igor-suhorukov c782075a13 Polish: Array designators "[]" should be on the type, not the variable 2018-02-25 13:14:20 +01:00
Juergen Hoeller 3531c104b0 Prefer Collections.addAll call with array over Set.addAll(Arrays.asList) 2018-02-25 00:21:39 +01:00
igor-suhorukov 67a91cf6f9 Polish: redundant pairs of parentheses should be removed 2018-02-25 00:01:43 +01:00
Juergen Hoeller 0f740527c1 Deprecated StringUtils.mergeStringArrays 2018-02-22 15:13:57 +01:00
Juergen Hoeller a5cbf5fe24 Consistent use of Collection.toArray with zero-sized array argument
Includes consistent use of ClassUtils.toClassArray (as non-null variant)

Issue: SPR-16523
2018-02-22 11:29:46 +01:00
Juergen Hoeller f316f6a46a Remove unnecessary assertions from annotation resolution code paths
Issue: SPR-16514
2018-02-19 10:29:09 +01:00
Juergen Hoeller d7cab23e6d Consistent use of StringUtils.toStringArray
(cherry picked from commit 6d11b40)
2018-02-16 20:49:17 +01:00
Juergen Hoeller 8d3264f680 Prefer List.sort(Comparator) over Collections.sort(List, Comparator) 2018-02-16 10:23:18 +01:00
Juergen Hoeller 3b810f3544 Consistent Class array vs vararg declarations (and related polishing) 2018-02-14 14:44:00 +01:00
Juergen Hoeller 99662bc702 Polishing 2018-02-13 23:32:10 +01:00
igor-suhorukov 45e520ed86 Polish: remove unused private fields, remove empty operator 2018-02-13 23:00:18 +01:00
Juergen Hoeller 0c78c9c6f7 Refined javadoc and exception messages 2018-02-13 15:25:42 +01:00
Vladimir Sitnikov 659f13be1c Avoid creating message arguments to Assert.isABC calls
See 67f184293b
2018-02-13 12:31:49 +01:00
Juergen Hoeller b449928691 Avoid unused arguments for internal delegates 2018-02-13 11:40:28 +01:00
Juergen Hoeller b089ded5b0 Polishing 2018-02-12 15:55:18 +01:00
igor-suhorukov 0ee505b73e Polish: assertion arguments should be passed in the correct order,
use assertNull instead of assertEquals(null, value),
declare delta as double value in assertEquals
2018-02-10 17:17:28 +01:00
igor-suhorukov 6ea0af3540 Polish: Lambdas should be replaced with method references 2018-02-10 12:09:46 +01:00
igor-suhorukov 9a6fbf59c5 Polish: follow name convention - make immutable fields final 2018-02-10 12:09:19 +01:00
Juergen Hoeller e873b18f43 ResolvableType.forClassWithGenerics retains original TypeVariables
Issue: SPR-16456
2018-02-09 15:29:00 +01:00
Stephane Nicoll 991eb4858e Update copyright header 2018-02-09 10:16:58 +01:00
igor-suhorukov e381514b07 Collection.isEmpty() should be used to test for emptiness
Closes gh-1670
2018-02-09 10:11:44 +01:00
igor-suhorukov 4c888d0f32 Polish
Closes gh-1669
2018-02-09 10:10:05 +01:00
Arjen Poutsma fb61af1882 Allow "release on close" for DataBuffer.asInputStream
This commit introduces DataBuffer.asInputStream(boolean), that can
release the underlying buffer when the stream is closed.

Furthermore, this commit adds additional javadoc.

Issue: SPR-16444
2018-02-08 10:11:53 +01:00
Arjen Poutsma 609f173ebc StringDecoder shouldn't chop off strings randomly
Issue: SPR-16337
2018-02-02 15:59:21 +01:00
Juergen Hoeller cfe7ff1c81 MimeType.compareTo uses case-insensitive Charset (analogous to equals)
Issue: SPR-16458
2018-02-02 13:44:07 +01:00
Juergen Hoeller c5a33d62dd TypeVariablesVariableResolver compares variables by full equality again
Issue: SPR-16456
2018-02-02 12:41:43 +01:00
Juergen Hoeller 30f6e447d5 TypeVariablesVariableResolver compares variables by name
Issue: SPR-16456
2018-02-02 11:34:36 +01:00
Juergen Hoeller ef3f93e84a Language tag parsing support in StringUtils and StringToLocaleConverter
Issue: SPR-16188
2018-01-25 19:10:31 +01:00
Arjen Poutsma 0befc60c8f Renamed DataBufferUtils/DataBufferFactory.compose to join
Issue: SPR-16365
2018-01-22 10:51:07 +01:00
sdeleuze 3f3141cdda Add additional test for SPR-16210
Issue: SPR-16210
2018-01-22 10:29:21 +01:00
Juergen Hoeller b2ce98e881 Upgrade to CGLIB 3.2.6
Issue: SPR-16267
2018-01-20 14:29:56 +01:00
Juergen Hoeller 572c668726 Polishing 2018-01-19 21:30:37 +01:00
Arjen Poutsma 5520e730f1 DataBufferUtils.read should not take input stream/channel as parameter
Fixed by creating `Callable`-based variants, as explained in the JIRA
issue.

Issue: SPR-16403
2018-01-19 17:38:14 +01:00
Juergen Hoeller 4c7414833b ResolvableType returns clone for cached state with original local source
Issue: SPR-16210
2018-01-19 12:30:03 +01:00
Juergen Hoeller ea5f8f5a7c Consistently handle NoClassDefFoundError in BeanUtils and related places
Issue: SPR-16369
2018-01-17 20:24:57 +01:00
Juergen Hoeller 4c9ed0d87e Polishing 2018-01-12 18:24:00 +01:00
Juergen Hoeller 06e6386dc9 CollectionUtils.lastElement for common Set/List extraction
Issue: SPR-16374
2018-01-12 18:23:52 +01:00
Juergen Hoeller 347c2daa2c Test for multiple interfaces at BridgeMethodResolver level
Issue: SPR-16288
2018-01-12 16:45:38 +01:00
Arjen Poutsma 67e7c784e8 Use DataBufferUtils.compose and remove writeAggregator
Use DataBufferUtils.compose instead of writeAggregator to combine
multiple data buffers into one, as the write aggregator would not work
when the initial data buffer did not have enough capacity to contain
all subsequent buffers.

Removed writeAggregator, as it is no longer needed.

Issue: SPR-16365
2018-01-12 10:36:09 +01:00
Arjen Poutsma 384a399fd2 Add DataBufferUtils.compose
Added a utility method that composes data buffers into a single buffer.
Depending on the `DataBuffer` implementation, the returned buffer may be
a single buffer containing all data of the provided buffers, or it may
be a true composite that contains references to the buffers.

Issue: SPR-16365
2018-01-12 10:36:09 +01:00
Juergen Hoeller 121f9e3734 BridgeMethodResolver properly resolves all declared interfaces
Issue: SPR-16288
2018-01-11 10:18:27 +01:00
Arjen Poutsma 5adaa1030c Javadoc 2018-01-10 17:54:51 +01:00
Arjen Poutsma 8a129ef3da Use write aggregator from DataBufferUtils
This commit uses the newly introduced write aggregator from
DataBufferUtils throughout WebFlux.

Issue: SPR-16351
2018-01-10 11:15:47 +01:00
Arjen Poutsma 69ccba30e9 Introduce write aggregator to DataBufferUtils
As a consequence of dropping CompositeByteBuf (see prior commit),
DataBuffers fluxes that are aggregated with Flux.reduce(BiFunction) are
now required to be released, as the composite no longer holds a
reference to subsequent data buffers.

For this purpose, DataBufferUtils now has a writeAggregator that can be
used with Flux.reduce, and that released the subsequent buffers
properly.

Issue: SPR-16351
2018-01-10 11:14:02 +01:00
Arjen Poutsma e6893da971 Remove use of CompositeByteBuf in NettyDataBuffer
Prior to this commit, NettyDataBuffer had a optimization in
write(ByteBuf...), where it used a CompositeByteBuf to hold the original
and the parameter buffer.
Unfortunately, this procedure has nasty consequences when splicing
buffers (see https://stackoverflow.com/a/48111196/839733).

As of this commit, NettyDataBuffer stopped using CompositeByteBuf, and
 simply does ByteBuf.write().

Issue: SPR-16351
2018-01-10 11:05:41 +01:00
Juergen Hoeller 45828cb934 Check BeanInfoFactory for interface introspection as well
Issue: SPR-16322
2018-01-08 18:05:02 +01:00
Juergen Hoeller 7ad69bfc20 Avoid extra existence check in SimpleMetadataReaderFactory
Issue: SPR-16281
2018-01-07 23:18:52 +01:00
Juergen Hoeller 1a154c3e4c Consistently throw FileNotFoundException even for NIO access
Issue: SPR-16334
2018-01-07 23:18:28 +01:00
Rossen Stoyanchev f4d8c7cc2b Improve decodeToMono support
This commit ensures uniform support for decodeToMono across the various
byte and String related decoders.

Issue: SPR-16253
2017-12-14 16:59:34 -05:00
Christoph Dreis 260ebeca3a Improve performance of some string operations
Issue: SPR-16293
2017-12-12 17:14:24 +01:00
Sam Brannen 767ea9db83 Fix minor logic error in SocketUtils 2017-12-06 17:00:29 -08:00
Tony Mitchell 9f36d170be Support identical minPort and maxPort in SocketUtils (#1612)
This commit fixes a bug where an IllegalStateException was
thrown if the minPort and maxPort values supplied to
SocketUtils.findAvailableTcpPort(int, int) were identical.
2017-12-06 16:38:46 -08:00
Sam Brannen f9689dfe48 Polishing 2017-12-06 15:54:02 -08:00
Sam Brannen 773cd3241b Polishing 2017-11-28 14:11:21 +01:00
Juergen Hoeller 0cc644f61f Polishing 2017-11-21 16:34:08 +01:00
sdeleuze 9f1d8517ba Polish Kotlin source code style 2017-11-21 15:59:23 +01:00
Juergen Hoeller 5843173567 Polishing 2017-11-21 13:42:57 +01:00
jianglei 4b614dc1de Fix copy/paste in Javadoc
Closes gh-1601
2017-11-21 06:58:14 +01:00
Rossen Stoyanchev bc8e525e60 Add shared instance of ReactiveAdapterRegistry
Issue: SPR-16218
2017-11-20 17:02:22 -05:00
Juergen Hoeller 84699c8b9b Document common use cases for @Order vs @Priority vs @DependsOn
Issue: SPR-16213
2017-11-20 12:53:37 +01:00
Arjen Poutsma e4d405271a Document DataBuffer/PooledDataBuffer and codecs
Issue: SPR-16156
2017-11-16 11:36:26 +01:00
diesieben07 0e49e32188 Handle parameters of Kotlin extension methods correctly
The EXTENSION_RECEIVER parameter of Kotlin's extension
methods appear as normal method parameters to Java and
thus require a name. The synthetic name "$receiver" is
used here, as it is not a valid Kotlin identifier,
but valid in Java.

Issue: SPR-16119
2017-11-13 15:42:32 +01:00
Sam Brannen 2be2aa7b96 Add missing word to JavaDoc 2017-11-13 00:46:20 +01:00
Arjen Poutsma 8223809455 Use existing CompositeByteBuf if possible
This commit uses the existing CompositeByteBuf if present, as opposed
to creating a new composite for every call to
NettyDataBuffer.write(ByteBuf...)

Issue: SPR-16180
2017-11-10 15:09:14 +01:00
Juergen Hoeller 9b7af8b5aa Polishing 2017-11-05 21:07:26 +01:00
Juergen Hoeller 07b479e264 FileUrlResource creates same class from createRelative
Issue: SPR-16140
2017-11-05 21:01:29 +01:00
Juergen Hoeller 996d747aed Upgrade to Mockito 2.11
Includes fixes for invalid exception declarations in Mockito-based unit tests. Also includes FreeMarker 2.3.27, Commons Pool 2.4.3, JSON-P 1.1.2.

Issue: SPR-16157
2017-11-04 01:06:59 +01:00
Juergen Hoeller d00e4f17ec ClassPathResource uses specific constructors in createRelative
Issue: SPR-16146
2017-11-02 16:05:57 +01:00
Juergen Hoeller b921d564d2 DefaultResourceLoader resolves writable FileUrlResource for "file:" URL
Issue: SPR-16140
2017-11-02 16:05:40 +01:00
Juergen Hoeller a2f5e1254e Drive letter case alignment in addClassPathManifestEntries
Issue: SPR-16117
2017-10-26 15:28:27 +02:00
Juergen Hoeller 7e8c8f0b76 Polishing 2017-10-25 19:23:48 +02:00
Juergen Hoeller 2d0ab4740c Consistent hasText checks for CharSequence vs String
Directly inlined hasLength implementations for proper nullability detection in IntelliJ, assuming a hasText checked value is never null afterwards. Since the JVM is going to do this at runtime anyway, this is effectively equivalent but more indicative for source code introspection algorithms.

Issue: SPR-15540
2017-10-24 13:16:47 +02:00
Juergen Hoeller 182da15908 BridgeMethodResolver properly resolves interface hierarchies
Issue: SPR-16103
2017-10-24 01:01:49 +02:00
Juergen Hoeller 55b0c2f243 Polishing 2017-10-24 01:01:42 +02:00
Juergen Hoeller ecea82d3a5 Polishing 2017-10-23 17:14:09 +02:00
Juergen Hoeller 75ec973bae Refined tests for StringUtils.starts/endsWithIgnoreCase
Issue: SPR-16095
2017-10-22 20:29:46 +02:00
Juergen Hoeller 5d41e0f012 Avoid temporary String creation in StringUtils.starts/endsWithIgnoreCase
Issue: SPR-16095
2017-10-22 14:31:17 +02:00
Juergen Hoeller 9a88ebdeba Consistent hasText checks for CharSequence vs String
Issue: SPR-15540
2017-10-22 12:12:32 +02:00
Arjen Poutsma c7a15260d6 Various DataBuffer improvements
This commit introduces various improvements in DataBuffer:

- DataBuffer now exposes its read and write position, as well as its
capacity and writable byte count.
- Added DataBuffer.asByteBuffer(int, int)
- DataBufferUtils.read now reads directly into a DataBuffer, rather than
copying a ByteBuffer into a DataBuffer
- TomcatHttpHandler now reads directly into a DataBuffer

Issues: SPR-16068 SPR-16070
2017-10-19 10:38:52 +02:00
Juergen Hoeller 3d1023be8c Polishing 2017-10-17 11:56:30 +02:00
Rossen Stoyanchev b4c95bf278 ReactiveAdapterRegistry uses Reactor's JdkFlowAdapter
Issue: SPR-16052
2017-10-16 20:49:22 -04:00
Juergen Hoeller c29b6f5b55 Consistent handling of null array for arguments
Issue: SPR-16075
2017-10-16 15:34:18 +02:00
Sam Brannen 8a94077da0 Clean up warnings in spring-core 2017-10-15 18:28:08 +02:00
Juergen Hoeller 43b5e21947 Consistent alias declarations for value attribute on stereotypes
Issue: SPR-16066
2017-10-13 18:18:12 +02:00
Juergen Hoeller dc3299152c Polishing 2017-10-09 16:06:03 +02:00
Juergen Hoeller 53091c76bf Convenient forType methods for ParameterizedTypeReference
Issue: SPR-16054
2017-10-09 13:59:01 +02:00
Juergen Hoeller ec345bf162 Revised handling of missing data class arguments
Includes unified detection of Kotlin's optional parameters in MethodParameter.isOptional(), reduces BeanUtils.findPrimaryConstructor to Kotlin semantics (for reuse in AutowiredAnnotationBeanPostProcessor), and finally introduces a common KotlinDetector delegate with an isKotlinType(Class) check.

Issue: SPR-15877
Issue: SPR-16020
2017-09-28 00:31:12 +02:00
Juergen Hoeller efce7902c4 Polishing 2017-09-27 01:34:11 +02:00
Juergen Hoeller 9d8e3d4185 Explicit check for duplicates in addClassPathManifestEntries
Issue: SPR-15989
2017-09-26 11:49:49 +02:00
Sebastien Deleuze 3996f33399 Support non-standard classes in Kotlin reflection discovery methods
Issue: SPR-15999
2017-09-24 23:10:40 +02:00
Juergen Hoeller e2882fe1db Build against EE 8 API level wherever possible
Upgrade to JAXB 2.3, JAX-WS 2.3, Annotations 1.3.1, Interceptor 1.2.1.
Also includes Log4J 2.9.1 and Asciidoctor 1.5.6.
2017-09-24 17:18:21 +02:00
Juergen Hoeller 9190b76ab9 Latest dependency updates (POI 3.17, Rome 1.8, EhCache 3.4, Caffeine 2.5.6, RxJava 2.1.4, Tomcat 8.5.21, JRuby 9.1.13, Rhino 1.7.7.2) 2017-09-23 11:28:19 +02:00
Juergen Hoeller 7ae59d0c2a Nullability refinements on private and static methods
Based on IntelliJ IDEA 2017.3 introspection results.

Issue: SPR-15756
2017-09-22 18:22:14 +02:00
Sebastien Deleuze 6c4a103f70 Remove support for generics nullability for now
See https://github.com/Kotlin/KEEP/issues/79
2017-09-21 18:44:27 +02:00
Juergen Hoeller 15c82afc1c Consistent conversion of Optional array/list arrangements
Issue: SPR-15918
Issue: SPR-15919
Issue: SPR-15676
2017-09-20 18:28:49 +02:00
Juergen Hoeller 185c2bf5b6 Upgrade to ASM 6.0
Issue: SPR-14514
2017-09-19 13:49:32 +02:00
Juergen Hoeller 346d2edce1 Revised org.springframework.lang javadoc
Issue: SPR-15756
2017-09-18 23:59:11 +02:00
Sebastien Deleuze 1bc93e3d0f Revisit nullability annotations
This commit introduces the following changes.

1) It adds a new Spring @NonNull annotation which allows to apply
@NonNullApi semantic on a specific element, like @Nullable does.
Combined with @Nullable, it allows partial null-safety support when
package granularity is too broad.

2) @Nullable and @NonNull can apply to ElementType.TYPE_USE in order
to be used on generic type arguments (SPR-15942).

3) Annotations does not apply to ElementType.TYPE_PARAMETER anymore
since it is not supported yet (applicability for such use case is
controversial and need to be discussed).

4) @NonNullApi does not apply to ElementType.FIELD anymore since in a
lot of use cases (private, protected) it is not part for the public API
+ its usage should remain opt-in. A dedicated @NonNullFields annotation
has been added in order to set fields default to non-nullable.

5) Updated Javadoc and reference documentation.

Issue: SPR-15756
2017-09-15 13:26:41 +02:00
Sebastien Deleuze 5ae35f606c Leverage kotlin-reflect to determine parameter names
This is especially useful to determine interface parameter names
without requiring Java 8 -parameters compiler flag.

Issue: SPR-15541
2017-09-06 15:56:45 +02:00
Juergen Hoeller 204ddebd68 SimpleAsyncTaskExecutor properly respects NO_CONCURRENCY
Issue: SPR-15895
2017-09-01 13:44:49 +02:00
Brian Clozel 397fd24849 Revert "Leverage Kotlin plugin dependency management"
This reverts commit 3e2f6c848a.
2017-08-22 21:29:39 +02:00
Sebastien Deleuze 3e2f6c848a Leverage Kotlin plugin dependency management 2017-08-22 17:35:57 +02:00
Sebastien Deleuze ab6430569d Efficient Kotlin metadata detection
Follow-up of 3991ab4a23.

Issue: SPR-15673
2017-08-22 16:22:25 +02:00
Brian Clozel cc3d7d2d48 Apply dependency management to selected modules
This commit applies the Dependency Management Plugin to modules that
require it; right now Spring Framework is importing BOMs for Netty and
Reactor dependencies only.

Instead of applying those BOMs to all modules, they're applied only
where they're needed.

Issue: SPR-15885
2017-08-21 14:42:03 +02:00
Brian Clozel 2eeb428e95 Move modules to independent build files
The main `build.gradle` file contains now only the common build
infrastructure; all module-specific build configurations have
been moved to their own build file.

Issue: SPR-15885
2017-08-21 14:41:55 +02:00
Juergen Hoeller 3991ab4a23 Efficient Kotlin metadata detection
Issue: SPR-15673
2017-08-21 01:33:20 +02:00
Sebastien Deleuze 73cf07e9a4 Fix overridden methods nullability
Issue: SPR-15869
2017-08-17 15:02:59 +02:00
Juergen Hoeller fabc9c28d7 Align new FileSystemUtils NIO implementation with original behavior
Issue: SPR-15845
Issue: SPR-15846
2017-08-03 14:21:00 +02:00
Juergen Hoeller 26de6268aa Polishing 2017-07-27 16:06:56 +02:00
Juergen Hoeller fac83b2e7c Consistent logging in Environment and PropertySource implementations
Issue: SPR-15825
2017-07-27 16:02:18 +02:00
Juergen Hoeller c5fc400534 (AnnotationAware)OrderComparator supports null values again
Issue: SPR-15823
2017-07-27 11:39:05 +02:00
Arjen Poutsma d5da823482 Fix race condition for AsynchronousFileChannel
This commit fixes an issue in the DataBufferUtils.write variant that
takes a AsynchronousFileChannel.

Issue: SPR-15798
2017-07-26 14:10:48 +02:00
Rossen Stoyanchev d7a7b08b08 Find the last plus for suffix MediaType
Issue: SPR-15795
2017-07-25 10:45:59 +02:00
Sebastien Deleuze 2437500cfe Ignore DataBufferUtilsTests#writeAsynchronousFileChannel
Issue: SPR-15798
2017-07-20 13:51:13 +02:00
Juergen Hoeller e4651d6b50 XmlEventDecoder uses common defensive XMLInputFactory (now in StaxUtils)
Issue: SPR-15797
2017-07-20 13:17:27 +02:00
Sebastien Deleuze fa4d139684 Support instantiating Kotlin classes with optional parameters
This commit updates BeanUtils class in order to add Kotlin optional
parameters with default values support to the immutable data classes
support introduced by SPR-15199.

Issue: SPR-15673
2017-07-20 10:44:06 +02:00
Juergen Hoeller 46eba3dbfa Nullability fine-tuning around declaration inconsistencies
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 22:22:20 +02:00
Juergen Hoeller 9fc4fb10b0 Nullability fine-tuning around bean properties
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 11:43:58 +02:00
Sebastien Deleuze fb4ddb0746 Make getters and setters null-safety consistent
This commit ensure that null-safety is consistent between
getters and setters in order to be able to provide beans
with properties with a common type when type safety is
taken in account like with Kotlin.

It also add a few missing property level @Nullable
annotations.

Issue: SPR-15792
2017-07-19 09:07:56 +02:00
Sebastien Deleuze e2fd04dff3 Add a [] Kotlin extension for PropertyResolver#getRequiredProperty 2017-07-19 08:12:32 +02:00
Juergen Hoeller 12114a9d4c Consistent use of NIO.2 for file read/write interactions
Issue: SPR-15748
2017-07-18 00:54:41 +02:00
Rossen Stoyanchev d56fedc226 Methods for reading a Resource in DataBufferUtils
Currently ResourceEncoder and ResourceRegionEncoder use DataBufferUtils
to read resource with an AsynchronousFileChannel if it is a file or
otherwise fallback on getting the channel from the resource.

The same is now required in other places where a Resource needs to be
read and is also generally useful.

Issue: SPR-15773
2017-07-17 12:25:25 +02:00
Rossen Stoyanchev d3749bc1ec Add timeout to DataBufferUtilsTests to avoid hanging 2017-07-14 23:07:48 +02:00
Arjen Poutsma c802827f0f Change write methods to return Flux<DataBuffer>
This commit changes the write methods to return `Flux<DataBuffer>`
instead of `Mono<Void>`, giving access to the original buffers,
so that they can decided whether the buffers need to be closed or not.

Issue: SPR-15726
2017-07-14 18:55:25 +02:00
Arjen Poutsma 83051b06b8 Add write methods to DataBufferUtils
This commit adds an overloaded write method to `DataBufferUtils`. There
are three parameter variants: `OutputStream`, `WritableByteChannel`, and
`AsynchronousFileChannel`.

Issue: SPR-15726
2017-07-14 17:13:59 +02:00
Rossen Stoyanchev dfcc9af938 Lazy registration in ReactiveAdapterRegistry
Issue: SPR-15747
2017-07-11 13:04:43 +02:00
Juergen Hoeller 3714e7b044 Deprecate FileSystemUtils
Issue: SPR-15748
2017-07-10 14:25:13 +02:00
Juergen Hoeller 9b5132ce53 LinkedCaseInsensitiveMap exposes its locale for key conversion
Issue: SPR-15752
2017-07-10 14:24:28 +02:00
Juergen Hoeller 398322139a StringUtils.uncapitalize is not actually nullable
Issue: SPR-15540
2017-07-05 17:56:37 +02:00
Arjen Poutsma 621df7c978 Add ByteBuf leak detection @Rule
This commit introduces a JUnit rule that detects ByteBuf leaks in
subclasses of AbstractDataBufferAllocatingTestCase.
2017-06-30 10:52:00 +02:00
Juergen Hoeller cc74a2891a @Nullable all the way: null-safety at field level
This commits extends nullability declarations to the field level, formalizing the interaction between methods and their underlying fields and therefore avoiding any nullability mismatch.

Issue: SPR-15720
2017-06-30 01:54:16 +02:00
Juergen Hoeller 87430f3cd3 ListenableFuture provides CompletableFuture adaptation via completable()
Issue: SPR-15696
2017-06-27 00:43:37 +02:00
Juergen Hoeller 41eaf03bc8 Compatibility with covariant return type on JDK 9's ByteBuffer
Issue: SPR-15686
2017-06-26 23:22:28 +02:00
Juergen Hoeller 098ff6f0f8 Compatibility with JDK 9 release candidate build (175)
Includes upgrade to Objenesis 2.6, Gradle 3.5.1, RxJava 2.1.1, JSON Binding API 1.0 final.

Issue: SPR-15686
Issue: SPR-15600
2017-06-26 18:58:59 +02:00
Stephane Nicoll 58242f2249 Polish 2017-06-13 10:13:14 +02:00
Stephane Nicoll fc64b8040f Polish "Replace relevant code with lambda"
Closes gh-1454
2017-06-13 09:42:20 +02:00
diguage 4b1478d830 Replace relevant code with lambda
See gh-1454
2017-06-13 08:55:38 +02:00
Juergen Hoeller 3ae84d6dd8 Consistent support for Charset/StandardCharsets in UriUtils etc
Issue: SPR-15613
2017-06-12 15:51:45 +02:00
diguage 2efa06237a Use Map#forEach instead of Map#entrySet#forEach
See gh-1449
2017-06-12 14:37:33 +02:00
Arjen Poutsma 9bf82dc18f Add addAll(MultiValueMap)
This commit introduces a new method for MultiValueMap: addAll, which
adds all values of a given map (cf putAll, which replaces existing
values).
2017-06-12 14:12:12 +02:00
Arjen Poutsma 7085a30382 Improve capacity calculcation in DefaultDataBuffer
This commit improves the capacity calculation for the DefaultDataBuffer,
so that the capacity typically doubles instead of improving by the
minimal required amount.

Issue: SPR-15647
2017-06-12 11:04:19 +02:00
Stephane Nicoll 27aabb15f9 Polish "Refact iterator of Map with Java 8 forEach"
Closes gh-1451
2017-06-12 08:53:56 +02:00
diguage dab7a7f0ee Refact iterator of Map with Java 8 forEach
See gh-1451
2017-06-12 08:11:32 +02:00
Juergen Hoeller fd53d2a51a Consistent use of @Nullable in spring-test
This commit also removes nullability from two common spots: ResolvableType.getType() and TargetSource.getTarget(), both of which are never effectively null with any regular implementation. For such scenarios, a non-null empty type/target is the cleaner contract.

Issue: SPR-15540
2017-06-08 22:52:59 +02:00
Juergen Hoeller e6f1950952 Missing @Nullable annotations for findAnnotation/getValue/getDefaultValue
Note that synthesizeAnnotation has an assertion now, keeping its non-null policy.

Issue: SPR-15642
2017-06-08 10:35:54 +02:00
Phillip Webb 72cd24446d Make resolvePropertyName available to subclasses
Change `SystemEnvironmentPropertySource.resolvePropertyName` to a
protected final method so that subclasses may call it.

Issue: SPR-15617
2017-06-07 17:03:31 -07:00
Phillip Webb c675424189 Restore AnnotationUtils null argument support
Update AnnotationUtils to restore support for `null` arguments in
certain methods. Some existing upstream projects were relying on this
behavior.

Issue: SPR-15642
2017-06-07 16:59:24 -07:00
Juergen Hoeller f813712f5b Consistent use of @Nullable across the codebase (even for internals)
Beyond just formally declaring the current behavior, this revision actually enforces non-null behavior in selected signatures now, not tolerating null values anymore when not explicitly documented. It also changes some utility methods with historic null-in/null-out tolerance towards enforced non-null return values, making them a proper citizen in non-null assignments.

Some issues are left as to-do: in particular a thorough revision of spring-test, and a few tests with unclear failures (ignored as "TODO: NULLABLE") to be sorted out in a follow-up commit.

Issue: SPR-15540
2017-06-07 14:19:15 +02:00
Stephane Nicoll 6e3a9cbbb4 Polish "Refactor duplicated code"
Closes gh-1445
2017-06-04 13:06:09 +02:00
diguage 5288641c50 Refactor duplicated code
See gh-1445
2017-06-04 13:01:03 +02:00
diguage eae63786c2 Fixed reference 2017-06-03 15:19:36 +08:00
Sebastien Deleuze 90df7dd279 Add missing @Nullable annotation
Issue: SPR-15540
2017-06-02 14:16:19 +02:00
Sebastien Deleuze b494c53b40 Avoid defining nullability for non-relevant API
Defining nullability of some API like EnvironmentCapable
or ConditionContext causes issues in Spring Boot because
in the context where they are used, it is known for sure
they will return non-null values even if their API can in
other context return null values.

It is better in this case for both Java and Kotlin to
not define at all the nullabity of such API.

In practice, this is achieved by removing the package level
@NonNullApi annotation and adding it only on the
relevant classes.

Issue: SPR-15540
2017-05-31 22:51:33 +02:00
Sebastien Deleuze 1f28825f9d Add more @Nullable parameters based on null usage
Issue: SPR-15540
2017-05-31 21:42:23 +02:00
Sebastien Deleuze c3e6afb879 Improve null-safety to fix some Spring Boot warnings
Issue: SPR-15540
2017-05-31 17:14:49 +02:00
Sebastien Deleuze b47d713e14 Add missing @Nullable annotations on parameters
Issue: SPR-15540
2017-05-31 16:56:08 +02:00
Sebastien Deleuze ad2c0f8410 Improve @Nullable annotation
This commit makes Spring @Nullable annotation leveraging
JSR 305 @TypeQualifierNickname + @Nonnull(when= When.MAYBE)
instead of directly using @javax.annotation.Nullable which
seems not designed to be used as a meta-annotation.

It also removes @TypeQualifierDefault since the purpose of
this annotation when applied at method level is to only
change return value nullability, not parameters one.

Issue: SPR-15540
2017-05-31 16:56:08 +02:00
Sebastien Deleuze 87598f48e4 Introduce null-safety of Spring Framework API
This commit introduces 2 new @Nullable and @NonNullApi
annotations that leverage JSR 305 (dormant but available via
Findbugs jsr305 dependency and already used by libraries
like OkHttp) meta-annotations to specify explicitly
null-safety of Spring Framework parameters and return values.

In order to avoid adding too much annotations, the
default is set at package level with @NonNullApi and
@Nullable annotations are added when needed at parameter or
return value level. These annotations are intended to be used
on Spring Framework itself but also by other Spring projects.

@Nullable annotations have been introduced based on Javadoc
and search of patterns like "return null;". It is expected that
nullability of Spring Framework API will be polished with
complementary commits.

In practice, this will make the whole Spring Framework API
null-safe for Kotlin projects (when KT-10942 will be fixed)
since Kotlin will be able to leverage these annotations to
know if a parameter or a return value is nullable or not. But
this is also useful for Java developers as well since IntelliJ
IDEA, for example, also understands these annotations to
generate warnings when unsafe nullable usages are detected.

Issue: SPR-15540
2017-05-27 08:57:01 +02:00
Juergen Hoeller db69a082d9 Avoid java.util.Optional signatures for simple field access
Issue: SPR-15576
2017-05-23 22:05:15 +02:00
Juergen Hoeller 7b3f5fd855 ResourceUtils.extractArchiveURL properly deals with top-level war URLs
Issue: SPR-15556
2017-05-17 14:22:43 +02:00
Rossen Stoyanchev 0d28a1c32b Polish 2017-05-05 15:02:09 -04:00
Rossen Stoyanchev 83e0e1604a Refine encoding/decoding exception handling
Starting with removing a package cycle on the use of
ResponseStatusException in the codec package, this commit generally
refines codec exception handling.

The new [Encoding|Decoding]Exception mirror the existing
HttpMessageNot[Readable|Writable]Exception and are used similarly
especially to differentiate betwen 400 and 500 errors when parsing
server request body content.

The commit also aligns some of the exception handling of JSON and XML
on the WebFlux side with that on the Spring MVC side.

Issue: SPR-15516
2017-05-05 14:29:43 -04:00
Juergen Hoeller 652266bcc2 Polishing 2017-05-04 22:27:36 +02:00
Juergen Hoeller d43dfc7bae Properly extract jar file from Tomcat war URL
Issue: SPR-15485
2017-05-03 21:58:59 +02:00
Juergen Hoeller 4d86515fa5 Overridable Commons Logging bridge in separate spring-jcl jar
Issue: SPR-14512
2017-05-03 20:29:05 +02:00
Juergen Hoeller 27057889f8 Polishing 2017-05-03 13:45:29 +02:00
Phillip Webb 07ef7a97c7 Cache SpringFactoriesLoader loads
Update `SpringFactoriesLoader` to cache property file loads. This helps
reduce the number of garbage objects created as each load uses an 8K
char buffer.

Issue: SPR-15509
2017-05-03 12:51:52 +02:00
Arjen Poutsma ed4bd43cac Add writableChannel to WritableResource
This commit introduces a `writableChannel()` method to
`WritableResource`, defaulting to `Channels.newChannel`, but with
overrides for file-based resources.
2017-05-03 11:44:01 +02:00
Juergen Hoeller 9d8e9cf243 Common root cause introspection algorithm in NestedExceptionUtils
Issue: SPR-15510
2017-05-03 11:31:28 +02:00
Juergen Hoeller 817e80c56b Property actually throws exception for no write method found
Issue: SPR-15507
2017-05-02 21:16:31 +02:00
Juergen Hoeller 7ca0094fa1 ResolvableType.clearCache() clears SerializableTypeWrapper cache as well
Issue: SPR-15503
2017-05-02 21:13:55 +02:00
Stephane Nicoll 1b9e12f52f Polish "Use Java 8 forEach method on Map"
Closes gh-1404
2017-04-28 11:07:08 +02:00