Commit Graph

525 Commits

Author SHA1 Message Date
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 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
Sebastien Deleuze b47d713e14 Add missing @Nullable annotations on parameters
Issue: SPR-15540
2017-05-31 16:56:08 +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
Sam Brannen c855182e03 Polishing 2017-04-26 18:59:43 +02:00
Juergen Hoeller c668d9a473 Polishing 2017-04-26 18:20:19 +02:00
Oleg Zhurakousky 299b9d60fd SPR-15481 Fixed AnnotationUtils.getValue() operation
- Fixed AnnotationUtils.getValue() operation to ensure it re-throws AnnotationConfigurationException instead of swallowing it (as it is done in few other operations in AnnotationUtils)
- Added test
- Removed unnecessary '@SuppressWarnings("unchecked")'
2017-04-26 15:05:32 +02:00
Rossen Stoyanchev cc102c2fcd Properly handle Flux<?> and Flux<Object> in WebFlux
Issue: SPR-15464
2017-04-20 09:19:38 -04:00
Rossen Stoyanchev 5c502b87ca Support for reactive types in Conventions
Issue: SPR-14915
2017-04-18 23:00:43 -04:00
Rossen Stoyanchev 71966b0777 Polish Conventions 2017-04-18 23:00:43 -04:00
Juergen Hoeller 0b118322b0 Polishing 2017-04-13 16:17:05 +02:00
Juergen Hoeller 3a1d431c7d Optimize StringUtils.replace/deleteAny for common no-op case
Issue: SPR-15430
2017-04-11 10:11:54 +02:00
Juergen Hoeller 7fbc20e225 Undeprecate TypeVariableMap methods on GenericTypeResolver
Issue: SPR-15429
2017-04-11 10:09:09 +02:00
Juergen Hoeller e5fdd4cd1d Extracted AbstractJsonHttpMessageConverter from GsonHttpMessageConverter
Generic type resolution algorithm in GenericTypeResolver shared between Jackson and Gson.

Issue: SPR-15381
2017-04-10 15:36:29 +02:00
Juergen Hoeller 67ea4b3a05 package-info for repackaged libraries (and other polishing) 2017-04-06 14:10:46 +02:00
Juergen Hoeller 75dd8d9c06 UrlResource applies StringUtils.getFilename against URL path
Issue: SPR-15411
2017-04-06 14:07:22 +02:00
Juergen Hoeller 47277f43da spring-core provides custom variant of Commons Logging
Includes dependency updates (JavaMail 1.6 RC1, RxJava 2.0.8, Tomcat 8.5.13, Undertow 1.4.12, XNIO 3.4.5)

Issue: SPR-14512
2017-04-05 21:22:44 +02:00
stonio 412947a53f Polish CollectionFactoryTests
Closes gh-1334
2017-03-27 12:51:11 +02:00
Rossen Stoyanchev 0662dbf044 String decoding for text only vs any MIME type
Follow-up to:
3d68c496f1

StringDecoder can be created in text-only vs "*/*" mode which in turn
allows a more intuitive order of client side decoders, e.g. SSE does
not have to be ahead of StringDecoder.

The commit also explicitly disables String from the supported types in
Jackson2Decoder leaving it to the StringDecoder in "*/*" mode which
comes after. This does not change the current arrangement since the
the StringDecoder ahead having "*/*" picks up JSON content just the
same.

From a broader perspective this change allows any decoder to deal with
String if it wants to after examining the content type be it the SSE
or another, custom decoder. For Jackson there is very little value in
decoding to String which works only if the output contains a single
JSON string but will fail to parse anything else (JSON object/array)
while StringDecoder in "*/*" mode will not fail.

Issue: SPR-15374
2017-03-23 16:53:06 -04:00
Rossen Stoyanchev 3d68c496f1 String encoding for any MIME type
CharSequenceEncoder now supports all MIME types, however since encoding
Flux<String> can overlap with other encoders (e.g. SSE) there are now
two ways to create a CharSequenceEncoder -- with support for text/plain
only or with support for any MIME type.

In WebFlux configuration we insert one CharSequenceEncoder for
text/plain (as we have so far) and a second instance with support for
any MIME type at the very end.

Issue: SPR-15374
2017-03-22 18:01:32 -04:00
Brian Clozel b799013567 Update to Reactor Aluminium SNAPSHOT
Currently the BOM versions are:

* reactor-core 3.0.6.BUILD-SNAPSHOT
* reactor-netty 0.6.2.BUILD-SNAPSHOT

This commit fixes as well a few deprecations in reactor-core.
2017-03-10 15:20:40 +01:00
Arjen Poutsma 63118c1ea7 Add DataBufferUtils.read w/ AsynchFileChannel
This commit adds an overloaded DataBufferUtils.read method that operates
on a AsynchronousFileChannel (as opposed to a ReadableByteChannel, which
already existed). This commit also uses said method in the Resource
encoders, if the Resource is a file.
2017-03-09 14:08:40 +01:00
Juergen Hoeller cbd19153c4 Polishing 2017-02-22 16:53:54 +01:00
Juergen Hoeller f4de1ea147 Polishing 2017-02-22 15:32:19 +01:00
Juergen Hoeller 6108ab1c31 Test for expected behavior of getAllMergedAnnotations vs findAllMergedAnnotations
Issue: SPR-15271
2017-02-22 15:28:34 +01:00
Stephane Nicoll 598d9a4b05 Add test to reproduce SPR-15271 2017-02-20 11:34:08 +01:00
Juergen Hoeller 9543384d9e Avoid deprecated comparators in tests
Issue: SPR-14779
2017-02-16 15:36:27 +01:00
Juergen Hoeller f90cd7705f Consistent ordering of Assert variants
Issue: SPR-15196
2017-02-16 15:32:07 +01:00
Juergen Hoeller 22322fde26 Revised isInstanceOf/isAssignable message concatenation
Issue: SPR-15196
2017-02-16 13:13:20 +01:00
Juergen Hoeller 448ea4cdfe Consistent logging in ignoreResourceNotFound scenarios
Issue: SPR-15218
2017-02-10 10:41:10 +01:00
Juergen Hoeller acf511ac0e Polishing 2017-02-02 20:11:06 +01:00
Juergen Hoeller 9666fcc41d SettableListenableFuture consistently tracks cancellation state
Issue: SPR-15202
2017-01-31 15:57:52 +01:00
Juergen Hoeller f84907a1fc Polishing 2017-01-31 12:00:13 +01:00
Juergen Hoeller 1b2dc3638f Revisit Assert to avoid single-arg assert methods (with refined messages)
Issue: SPR-15196
2017-01-30 22:15:55 +01:00
Arjen Poutsma 69c16f3821 Add headers in InterceptingClientHttpRequest
This commit *adds* the "intercepted" headers to the ClientHttpRequest,
as opposed to replacing them, which is what happened before this commit.

Issue: SPR-15166
2017-01-30 14:18:50 +01:00
Juergen Hoeller 5e946c2700 Consistent type variable resolution for arrays/collections (in particular at field level)
Dropping GenericCollectionTypeResolver in favor of direct ResolvableType usage.

Issue: SPR-15160
2017-01-24 18:00:17 +01:00
Juergen Hoeller ed40b1c8ee Remove outdated abstractions/delegates from core/util
Issue: SPR-15159
2017-01-23 13:41:55 +01:00
Sam Brannen 264edb3fb5 Improve initialization of Assume class
Prior to this commit, the org.springframework.tests.Assume class could
fail to load resulting in a NoClassDefFoundError if parsing of the
'testGroups' system property failed. This is because the parsing took
place while initializing a static field.

This commit addresses this issue by moving the 'testGroups' system
property lookup to a dedicated method that is lazily invoked upon
demand instead of eagerly when loading the Assume class itself.

In addition, when an error occurs, TestGroup.parse() now logs the
complete original value of the supplied test groups string instead of
potentially omitting the "all-" prefix. This results in more
informative error messages similar to the following.

  java.lang.IllegalStateException: Failed to parse 'testGroups' system
  property: Unable to find test group 'bogus' when parsing testGroups
  value: 'all-bogus'. Available groups include:
  [LONG_RUNNING,PERFORMANCE,JMXMP,CI]

Issue: SPR-15163
2017-01-19 05:58:02 +01:00
Arjen Poutsma 88c5f5981f Added DataBuffer Encoder/Decoder
This commit adds a DataBuffer Encoder and Decoder, and uses it in
the annotation-based processing model.

Note that these codecs are not used in the functional processing model,
since the BodyInserter/BodyExtractor already have methods for
writing/reading DataBuffers.

Issue: SPR-15148
2017-01-17 16:46:43 +01:00
Juergen Hoeller e59f4004eb Use MockitoJUnitRunner from Mockito 2's preferred location
Issue: SPR-14880
2017-01-16 23:08:06 +01:00
Juergen Hoeller 1cb381e9a7 Consistent deprecation markers on JDK 9 2017-01-13 10:53:20 +01:00
Juergen Hoeller 50e5a65b2d LinkedCaseInsensitiveMap provides case-insensitive keySet again
Issue: SPR-15026
2017-01-12 21:14:07 +01:00
Juergen Hoeller 8147c112f5 LinkedCaseInsensitiveMap delegates to LinkedHashMap instead of extending it
Issue: SPR-15026
2016-12-23 18:57:50 +01:00
Juergen Hoeller 8a7467020f Polishing 2016-12-15 15:44:16 +01:00
Juergen Hoeller 39d2769bd0 Autodetect Kotlin nullability for optional injection points (analogous to java.util.Optional)
Built-in support in MethodParameter and DependencyDescriptor supersedes our separate KotlinUtils helper.

Issue: SPR-14951
2016-12-13 17:38:58 +01:00
Juergen Hoeller aef1460a64 TypeDescriptor properly narrows ResolvableType for non-typed collection elements
Issue: SPR-14971
2016-12-12 22:28:48 +01:00
Juergen Hoeller 7714eeccf3 MimeType parsing properly handles quoted semicolons
Issue:  SPR-14986
2016-12-09 15:04:26 +01:00
Juergen Hoeller 01868096a3 Consistent catching of Throwable for introspection failures
Issue: SPR-12889
2016-11-30 22:24:14 +01:00
Juergen Hoeller f6b8b84df9 Efficient type plus annotation comparisons during converter retrieval
Issue: SPR-14926
Issue: SPR-12926
2016-11-30 22:22:44 +01:00
Rossen Stoyanchev 5651c2180e Further refactoring of ReactiveAdapter/Registry
Simplify getAdapterFrom/To into a single getAdapter method that looks
for an exact match by type first and then isAssignableFrom.

Also expose shortcut methods in ReactiveAdapter to minimize the need
for access to the ReactiveTypeDescriptor.

Issue: SPR-14902
2016-11-28 12:43:22 -05:00