Nullability refinements and related polishing

See gh-32475
This commit is contained in:
Juergen Hoeller
2024-03-19 09:58:44 +01:00
parent cd7ba1835c
commit c531a8a705
58 changed files with 327 additions and 257 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -309,9 +309,10 @@ class ChannelSendOperator<T> extends Mono<Void> implements Scannable {
}
private boolean emitCachedSignals() {
if (this.error != null) {
Throwable error = this.error;
if (error != null) {
try {
requiredWriteSubscriber().onError(this.error);
requiredWriteSubscriber().onError(error);
}
finally {
releaseCachedItem();

View File

@@ -33,7 +33,6 @@ import org.springframework.core.MethodParameter;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.core.ReactiveAdapter;
import org.springframework.core.ReactiveAdapterRegistry;
import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
import org.springframework.messaging.handler.HandlerMethod;
import org.springframework.messaging.handler.invocation.MethodArgumentResolutionException;
@@ -153,7 +152,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
MethodParameter returnType = getReturnType();
Class<?> reactiveType = (isSuspendingFunction ? value.getClass() : returnType.getParameterType());
ReactiveAdapter adapter = this.reactiveAdapterRegistry.getAdapter(reactiveType);
return (isAsyncVoidReturnType(returnType, adapter) ?
return (adapter != null && isAsyncVoidReturnType(returnType, adapter) ?
Mono.from(adapter.toPublisher(value)) : Mono.justOrEmpty(value));
});
}
@@ -200,8 +199,8 @@ public class InvocableHandlerMethod extends HandlerMethod {
}
}
private boolean isAsyncVoidReturnType(MethodParameter returnType, @Nullable ReactiveAdapter reactiveAdapter) {
if (reactiveAdapter != null && reactiveAdapter.supportsEmpty()) {
private boolean isAsyncVoidReturnType(MethodParameter returnType, ReactiveAdapter reactiveAdapter) {
if (reactiveAdapter.supportsEmpty()) {
if (reactiveAdapter.isNoValue()) {
return true;
}