Skip to content

Conversation

@xnslong
Copy link
Owner

@xnslong xnslong commented Jun 30, 2017

No description provided.

rstoyanchev and others added 30 commits May 26, 2017 09:19
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
Correct the javadoc for ExchangeResult.getUrl()
Essentially drop "Configurer" suffix from nested interfaces.
Simplify the internals of the DefaultCodecs implementation favoring
explicit fields per override vs a generic list of readers and writers
for overrides.
MultipartHttpMessageWriter is now configured to handle JSON and XML
out of the box.
This commit copies the MockServerRequest to the spring-test module, in
the mock.web.reactive.function.server package.

Issue: SPR-15530
Issue: SPR-15592
This commit introduces ExtractingResponseErrorHandler: an alternative
ResponseErrorHandler that uses `HttpMessageConverter`s to convert HTTP
error responses to `RestClientException`.

Issue: SPR-15544
Provide a mechanism to override the configured send and receive
timeouts in the GenericMessagingTemplate.

- overload `doReceive()` to take a receive timeout argument
- for `sendAndReceive()` methods examine message headers for these
  timeout values
  - remove headers to avoid propagation
  - avoid the unconditional rebuild of the reply message if the
    original headers weren't present
- also remove headers from simple `send()` operations
- change javadocs for the setters to indicate they are now defaults
- add properties to allow the user to override the header names used
- change `TemporaryReplyChannel` to use `send` arg and change to static
  - add package-protected ctor to avoid the compiler creating a
    synthetic constructor for access

Issue: SPR-15591
This commit replaces the UnaryOperatory<ServerWebExchange> inputs with
Function<ServerWebExchange, ServerWebExchange> instead. Unfortunately
the composability methods inherited from Function don't work in terms
of generics for composing multiple UnaryOperator's.

Issue: SPR-15599
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
The change to "optimize" the template by not rebuilding the reply
message when the original header channels was null was incorrect.

We need to null out those headers if they were originally null.

Issue: SPR-15991
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
This commit fixes the implementation of
ExtractingResponseErrorHandler.hasError to allow for null values,
indicating an override of the behavior inherited from
DefaultResponseErrorHandler.

Issue: SPR-15544
poutsma and others added 17 commits June 28, 2017 16:19
This commit introduces the Jackson2Tokenizer as a replacement for the
JsonObjectDecoder. The latter was dropped because of its complexity, and
hard dependency on Netty's ByteBuf.

The new Jackson2Tokenizer leverages the new non-blocking JSON parser,
using it to parse the incoming data buffers into TokenBuffers, each
token buffer representing one JSON object. As with JsonObjectDecoder,
it also supports streaming individual JSON array elements.

Issue: SPR-14528
Issue: SPR-14528
This commit changes the release of data buffers from a finally block
into a `doFinally()` lambda on the returned `Flux<XMLEvent>` stream.

Issue: SPR-15707
This commit introduces a `doFinally` block that properly signals the
end of input for the non-blocking XML and JSON parsers.
…ator

Explicit typing for older jvm compilation in BodyExtractor
... and a couple more protected methods in WebFlux

Issue: SPR-15718
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
Polish - the flag continueProcessing is not needed
This commit introduces a JUnit rule that detects ByteBuf leaks in
subclasses of AbstractDataBufferAllocatingTestCase.
@xnslong xnslong self-assigned this Jun 30, 2017
poutsma and others added 11 commits June 30, 2017 16:31
This commit introduces a cookies() method on ServerRequest, returning a
MultiValueMap<String, HttpCookie>.

Issue: SPR-15715
The new PathContainer represent the path as a series of elements
including separators. This naturally represents leading/trailing
slashes and empty path segments which in turn makes it easier to match
in PathPattern as well as to reconstruct the path.
Direct comparison of a pattern (as a String) to the path does not make
much sense now that we deal with URL encoding through PathContainer
which exposes (safely) decoded path segments.

Removing the PathPatternComparator also means we can keep patterns
pre-sorted instead of sorting them all the time. That probably offsets
any benefits from comparing to the lookup path for direct matches and
patterns are still sorted according to specificity.
Follow-up change to the previous commit.
@xnslong xnslong merged commit a0f0dd7 into xnslong:master Jul 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.