Skip to content

Commit

Permalink
Provide a warning when a raw RestResponse return type is used
Browse files Browse the repository at this point in the history
Closes: quarkusio#28627
(cherry picked from commit ed806c8)
  • Loading branch information
geoand authored and zakkak committed Nov 15, 2022
1 parent 29fbc4d commit 7e1be69
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,12 @@ private ResourceMethod createResourceMethod(ClassInfo currentClassInfo, ClassInf
Type methodContextReturnTypeOrReturnType = methodContext.containsKey(METHOD_CONTEXT_CUSTOM_RETURN_TYPE_KEY)
? (Type) methodContext.get(METHOD_CONTEXT_CUSTOM_RETURN_TYPE_KEY)
: currentMethodInfo.returnType();
if (REST_RESPONSE.equals(methodContextReturnTypeOrReturnType.name())
&& (methodContextReturnTypeOrReturnType.kind() == Kind.CLASS)) {
log.warn("Method '" + currentMethodInfo.name() + " of Resource class '"
+ currentMethodInfo.declaringClass().name()
+ "' returns RestResponse but does not declare a generic type. It is strongly advised to define the generic type otherwise the behavior could be unpredictable");
}
Type nonAsyncReturnType = getNonAsyncReturnType(methodContextReturnTypeOrReturnType);
addWriterForType(additionalWriters, nonAsyncReturnType);

Expand Down

0 comments on commit 7e1be69

Please sign in to comment.