Refine publisher type check in CoroutinesUtils

See gh-32390
This commit is contained in:
Sébastien Deleuze
2024-03-11 12:17:58 +01:00
parent 78fb378aef
commit 946082f806

View File

@@ -148,10 +148,10 @@ public abstract class CoroutinesUtils {
if (KTypes.isSubtypeOf(returnType, flowType)) {
return mono.flatMapMany(CoroutinesUtils::asFlux);
}
else if (KTypes.isSubtypeOf(returnType, monoType)) {
return mono.flatMap(o -> ((Mono<?>)o));
}
else if (KTypes.isSubtypeOf(returnType, publisherType)) {
if (KTypes.isSubtypeOf(returnType, publisherType)) {
if (KTypes.isSubtypeOf(returnType, monoType)) {
return mono.flatMap(o -> ((Mono<?>)o));
}
return mono.flatMapMany(o -> ((Publisher<?>)o));
}
return mono;