-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register return types on REST Interface methods for reflection #1260
Conversation
@@ -160,6 +175,11 @@ void processInterfaces(CombinedIndexBuildItem combinedIndexBuildItem, | |||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, iName)); | |||
} | |||
|
|||
// Register Interface return types for reflection | |||
for (Type returnType : returnTypes) { | |||
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, returnType.toString())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be ReflectiveHeirachyBuildItem, so it will attempt to also register super classes. You will also need to register methods (and probably fields) so that the serializer can actually set the values.
@@ -147,6 +154,16 @@ void processInterfaces(CombinedIndexBuildItem combinedIndexBuildItem, | |||
continue; | |||
} | |||
interfaces.put(theInfo.name(), theInfo); | |||
|
|||
// Find Return types | |||
for (MethodInfo method : theInfo.methods()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should only consider the methods with @GET
, @POST
..., shouldn't you?
Take a look at the RESTEasy processor, that might help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because otherwise you will register unnecessary reflection if you have other methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As these are interfaces, that's a lot less likely to happen than in a regular JAX-RS Resource
Fixes #1254