@@ -86,7 +86,6 @@ public class ReactiveAdapterRegistry {
86
86
* Create a registry and auto-register default adapters.
87
87
* @see #getSharedInstance()
88
88
*/
89
- @ SuppressWarnings ("unchecked" )
90
89
public ReactiveAdapterRegistry () {
91
90
// Defensive guard for the Reactive Streams API itself
92
91
if (!reactiveStreamsPresent ) {
@@ -115,10 +114,7 @@ public ReactiveAdapterRegistry() {
115
114
116
115
// Simple Flow.Publisher bridge if Reactor is not present
117
116
if (!reactorPresent ) {
118
- this .adapters .add (new ReactiveAdapter (
119
- ReactiveTypeDescriptor .multiValue (Flow .Publisher .class , () -> PublisherToRS .EMPTY_FLOW ),
120
- source -> new PublisherToRS <>((Flow .Publisher <Object >) source ),
121
- source -> new PublisherToFlow <>((Publisher <Object >) source )));
117
+ new FlowBridgeRegistrar ().registerAdapter (this );
122
118
}
123
119
}
124
120
@@ -375,6 +371,18 @@ void registerAdapters(ReactiveAdapterRegistry registry) {
375
371
}
376
372
377
373
374
+ private static class FlowBridgeRegistrar {
375
+
376
+ @ SuppressWarnings ("unchecked" )
377
+ void registerAdapter (ReactiveAdapterRegistry registry ) {
378
+ registry .registerReactiveType (
379
+ ReactiveTypeDescriptor .multiValue (Flow .Publisher .class , () -> PublisherToRS .EMPTY_FLOW ),
380
+ source -> new PublisherToRS <>((Flow .Publisher <Object >) source ),
381
+ source -> new PublisherToFlow <>((Publisher <Object >) source ));
382
+ }
383
+ }
384
+
385
+
378
386
private static class PublisherToFlow <T > implements Flow .Publisher <T > {
379
387
380
388
private static final Flow .Subscription EMPTY_SUBSCRIPTION = new Flow .Subscription () {
0 commit comments