Commit Graph

1374 Commits

Author SHA1 Message Date
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