Skip to content

Commit

Permalink
Ensure that RESTEasy Reactive knows the proper return type when Flow …
Browse files Browse the repository at this point in the history
…is used
  • Loading branch information
geoand committed Oct 6, 2022
1 parent f9dd29f commit 5a2c6a7
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,20 @@ public static Type getEffectiveReturnType(Type returnType) {
if (returnType instanceof ParameterizedType) {
ParameterizedType type = (ParameterizedType) returnType;
Type firstTypeArgument = type.getActualTypeArguments()[0];
if (type.getRawType() == CompletionStage.class) {
Type rawType = type.getRawType();
if (rawType == CompletionStage.class) {
return getEffectiveReturnType(firstTypeArgument);
}
if (type.getRawType() == Uni.class) {
if (rawType == Uni.class) {
return getEffectiveReturnType(firstTypeArgument);
}
if (type.getRawType() == Multi.class) {
if (rawType == Multi.class) {
return getEffectiveReturnType(firstTypeArgument);
}
if (type.getRawType() == RestResponse.class) {
if (rawType == RestResponse.class) {
return getEffectiveReturnType(firstTypeArgument);
}
if ("kotlinx.coroutines.flow.Flow".equals(rawType.getTypeName())) { // TODO: this is very ugly and we should probably use some an SPI in order to decouple
return getEffectiveReturnType(firstTypeArgument);
}
return returnType;
Expand Down

0 comments on commit 5a2c6a7

Please sign in to comment.