Fix nullability warnings
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.messaging.handler.invocation.reactive;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -120,7 +121,6 @@ public abstract class AbstractEncoderMethodReturnValueHandler implements Handler
|
||||
handleEncodedContent(Flux.from(publisher), returnType, message));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Flux<DataBuffer> encodeContent(
|
||||
@Nullable Object content, MethodParameter returnType, DataBufferFactory bufferFactory,
|
||||
@Nullable MimeType mimeType, Map<String, Object> hints) {
|
||||
@@ -132,9 +132,10 @@ public abstract class AbstractEncoderMethodReturnValueHandler implements Handler
|
||||
ResolvableType elementType;
|
||||
if (adapter != null) {
|
||||
publisher = adapter.toPublisher(content);
|
||||
boolean isUnwrapped = KotlinDetector.isSuspendingFunction(returnType.getMethod()) &&
|
||||
!COROUTINES_FLOW_CLASS_NAME.equals(returnValueType.toClass().getName());
|
||||
ResolvableType genericType = isUnwrapped ? returnValueType : returnValueType.getGeneric();
|
||||
Method method = returnType.getMethod();
|
||||
boolean isUnwrapped = (method != null && KotlinDetector.isSuspendingFunction(method) &&
|
||||
!COROUTINES_FLOW_CLASS_NAME.equals(returnValueType.toClass().getName()));
|
||||
ResolvableType genericType = (isUnwrapped ? returnValueType : returnValueType.getGeneric());
|
||||
elementType = getElementType(adapter, genericType);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -75,8 +75,10 @@ public abstract class TestContextAnnotationUtils {
|
||||
private static final ConcurrentLruCache<Class<?>, EnclosingConfiguration> cachedEnclosingConfigurationModes =
|
||||
new ConcurrentLruCache<>(32, TestContextAnnotationUtils::lookUpEnclosingConfiguration);
|
||||
|
||||
@Nullable
|
||||
private static volatile EnclosingConfiguration defaultEnclosingConfigurationMode;
|
||||
|
||||
|
||||
/**
|
||||
* Find the first annotation of the specified {@code annotationType} within
|
||||
* the annotation hierarchy <em>above</em> the supplied class, merge that
|
||||
@@ -411,13 +413,15 @@ public abstract class TestContextAnnotationUtils {
|
||||
}
|
||||
|
||||
private static EnclosingConfiguration getDefaultEnclosingConfigurationMode() {
|
||||
if (defaultEnclosingConfigurationMode == null) {
|
||||
EnclosingConfiguration defaultConfigurationMode = defaultEnclosingConfigurationMode;
|
||||
if (defaultConfigurationMode == null) {
|
||||
String value = SpringProperties.getProperty(NestedTestConfiguration.ENCLOSING_CONFIGURATION_PROPERTY_NAME);
|
||||
EnclosingConfiguration enclosingConfigurationMode = EnclosingConfiguration.from(value);
|
||||
defaultEnclosingConfigurationMode =
|
||||
defaultConfigurationMode =
|
||||
(enclosingConfigurationMode != null ? enclosingConfigurationMode : EnclosingConfiguration.INHERIT);
|
||||
defaultEnclosingConfigurationMode = defaultConfigurationMode;
|
||||
}
|
||||
return defaultEnclosingConfigurationMode;
|
||||
return defaultConfigurationMode;
|
||||
}
|
||||
|
||||
private static void assertNonEmptyAnnotationTypeArray(Class<?>[] annotationTypes, String message) {
|
||||
@@ -503,9 +507,10 @@ public abstract class TestContextAnnotationUtils {
|
||||
this.declaringClass = declaringClass;
|
||||
this.composedAnnotation = composedAnnotation;
|
||||
this.annotation = annotation;
|
||||
this.annotationAttributes = AnnotatedElementUtils.findMergedAnnotationAttributes(
|
||||
AnnotationAttributes attributes = AnnotatedElementUtils.findMergedAnnotationAttributes(
|
||||
rootDeclaringClass, annotation.annotationType().getName(), false, false);
|
||||
Assert.state(this.annotationAttributes != null, "No annotation attributes");
|
||||
Assert.state(attributes != null, "No annotation attributes");
|
||||
this.annotationAttributes = attributes;
|
||||
}
|
||||
|
||||
public Class<?> getRootDeclaringClass() {
|
||||
|
||||
@@ -126,16 +126,15 @@ public abstract class TestPropertySourceUtils {
|
||||
}
|
||||
|
||||
private static boolean duplicationDetected(TestPropertySourceAttributes currentAttributes,
|
||||
TestPropertySourceAttributes previousAttributes) {
|
||||
@Nullable TestPropertySourceAttributes previousAttributes) {
|
||||
|
||||
boolean duplicationDetected =
|
||||
(currentAttributes.equals(previousAttributes) && !currentAttributes.isEmpty());
|
||||
|
||||
if (duplicationDetected && logger.isDebugEnabled()) {
|
||||
logger.debug(String.format("Ignoring duplicate %s declaration on %s, "
|
||||
+ "since it is also declared on %s.", currentAttributes,
|
||||
previousAttributes.getDeclaringClass().getName(),
|
||||
currentAttributes.getDeclaringClass().getName()));
|
||||
logger.debug(String.format("Ignoring duplicate %s declaration on %s since it is also declared on %s",
|
||||
currentAttributes, currentAttributes.getDeclaringClass().getName(),
|
||||
previousAttributes.getDeclaringClass().getName()));
|
||||
}
|
||||
|
||||
return duplicationDetected;
|
||||
|
||||
@@ -851,6 +851,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Nullable
|
||||
private static Object awaitSingleOrNull(Publisher<?> publisher, Object continuation) {
|
||||
return AwaitKt.awaitSingleOrNull(publisher, (Continuation<Object>) continuation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user