diff --git a/spring-core/src/main/java/org/springframework/core/Conventions.java b/spring-core/src/main/java/org/springframework/core/Conventions.java
index 93a8a7eb443..691f1811a8d 100644
--- a/spring-core/src/main/java/org/springframework/core/Conventions.java
+++ b/spring-core/src/main/java/org/springframework/core/Conventions.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -118,13 +118,10 @@ public final class Conventions {
}
else {
valueClass = parameter.getParameterType();
- ReactiveAdapterRegistry reactiveAdapterRegistry = ReactiveAdapterRegistry.getSharedInstance();
- if (reactiveAdapterRegistry.hasAdapters()) {
- ReactiveAdapter adapter = reactiveAdapterRegistry.getAdapter(valueClass);
- if (adapter != null && !adapter.getDescriptor().isNoValue()) {
- reactiveSuffix = ClassUtils.getShortName(valueClass);
- valueClass = parameter.nested().getNestedParameterType();
- }
+ ReactiveAdapter adapter = ReactiveAdapterRegistry.getSharedInstance().getAdapter(valueClass);
+ if (adapter != null && !adapter.getDescriptor().isNoValue()) {
+ reactiveSuffix = ClassUtils.getShortName(valueClass);
+ valueClass = parameter.nested().getNestedParameterType();
}
}
@@ -207,13 +204,10 @@ public final class Conventions {
}
else {
valueClass = resolvedType;
- ReactiveAdapterRegistry reactiveAdapterRegistry = ReactiveAdapterRegistry.getSharedInstance();
- if (reactiveAdapterRegistry.hasAdapters()) {
- ReactiveAdapter adapter = reactiveAdapterRegistry.getAdapter(valueClass);
- if (adapter != null && !adapter.getDescriptor().isNoValue()) {
- reactiveSuffix = ClassUtils.getShortName(valueClass);
- valueClass = ResolvableType.forMethodReturnType(method).getGeneric().toClass();
- }
+ ReactiveAdapter adapter = ReactiveAdapterRegistry.getSharedInstance().getAdapter(valueClass);
+ if (adapter != null && !adapter.getDescriptor().isNoValue()) {
+ reactiveSuffix = ClassUtils.getShortName(valueClass);
+ valueClass = ResolvableType.forMethodReturnType(method).getGeneric().toClass();
}
}
diff --git a/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java b/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java
index 4383bb8ad58..7ce7dc8d01c 100644
--- a/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java
+++ b/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2019 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.
@@ -41,7 +41,7 @@ import org.springframework.util.ReflectionUtils;
*
*
By default, depending on classpath availability, adapters are registered
* for Reactor, RxJava 1, RxJava 2 types, {@link CompletableFuture}, and Java 9+
- * Flow.Publisher.
+ * {@code Flow.Publisher}.
*
* @author Rossen Stoyanchev
* @author Sebastien Deleuze
@@ -54,7 +54,7 @@ public class ReactiveAdapterRegistry {
private final boolean reactorPresent;
- private final List adapters = new ArrayList<>(32);
+ private final List adapters = new ArrayList<>();
/**
@@ -62,7 +62,6 @@ public class ReactiveAdapterRegistry {
* @see #getSharedInstance()
*/
public ReactiveAdapterRegistry() {
-
ClassLoader classLoader = ReactiveAdapterRegistry.class.getClassLoader();
// Reactor
@@ -104,8 +103,8 @@ public class ReactiveAdapterRegistry {
/**
* Register a reactive type along with functions to adapt to and from a
- * Reactive Streams {@link Publisher}. The functions can assume their
- * input is never be {@code null} nor {@link Optional}.
+ * Reactive Streams {@link Publisher}. The function arguments assume that
+ * their input is neither {@code null} nor {@link Optional}.
*/
public void registerReactiveType(ReactiveTypeDescriptor descriptor,
Function