|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2024 the original author or authors. |
| 2 | + * Copyright 2002-2025 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
19 | 19 | import java.lang.reflect.Method;
|
20 | 20 | import java.util.ArrayList;
|
21 | 21 | import java.util.List;
|
| 22 | +import java.util.Objects; |
22 | 23 | import java.util.Optional;
|
23 | 24 | import java.util.concurrent.CompletableFuture;
|
24 | 25 | import java.util.concurrent.CompletionStage;
|
25 | 26 | import java.util.concurrent.Flow;
|
26 | 27 | import java.util.function.Function;
|
27 | 28 |
|
| 29 | +import io.smallrye.mutiny.Multi; |
| 30 | +import io.smallrye.mutiny.Uni; |
28 | 31 | import org.jspecify.annotations.Nullable;
|
29 | 32 | import org.reactivestreams.FlowAdapters;
|
30 | 33 | import org.reactivestreams.Publisher;
|
@@ -380,13 +383,13 @@ void registerAdapters(ReactiveAdapterRegistry registry) {
|
380 | 383 | io.smallrye.mutiny.groups.MultiCreate.class, "publisher", Flow.Publisher.class);
|
381 | 384 | registry.registerReactiveType(uniDesc,
|
382 | 385 | uni -> FlowAdapters.toPublisher((Flow.Publisher<Object>)
|
383 |
| - ReflectionUtils.invokeMethod(uniToPublisher, ((io.smallrye.mutiny.Uni<?>) uni).convert())), |
384 |
| - publisher -> ReflectionUtils.invokeMethod(uniPublisher, io.smallrye.mutiny.Uni.createFrom(), |
385 |
| - FlowAdapters.toFlowPublisher(publisher))); |
| 386 | + Objects.requireNonNull(ReflectionUtils.invokeMethod(uniToPublisher, ((Uni<?>) uni).convert()))), |
| 387 | + publisher -> Objects.requireNonNull(ReflectionUtils.invokeMethod(uniPublisher, Uni.createFrom(), |
| 388 | + FlowAdapters.toFlowPublisher(publisher)))); |
386 | 389 | registry.registerReactiveType(multiDesc,
|
387 | 390 | multi -> FlowAdapters.toPublisher((Flow.Publisher<Object>) multi),
|
388 |
| - publisher -> ReflectionUtils.invokeMethod(multiPublisher, io.smallrye.mutiny.Multi.createFrom(), |
389 |
| - FlowAdapters.toFlowPublisher(publisher))); |
| 391 | + publisher -> Objects.requireNonNull(ReflectionUtils.invokeMethod(multiPublisher, Multi.createFrom(), |
| 392 | + FlowAdapters.toFlowPublisher(publisher)))); |
390 | 393 | }
|
391 | 394 | else {
|
392 | 395 | // Mutiny 1 based on Reactive Streams
|
|
0 commit comments