Skip to content
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

Merged
merged 2 commits into from
Mar 6, 2019
Merged

Register return types on REST Interface methods for reflection #1260

merged 2 commits into from
Mar 6, 2019

Conversation

kenfinnigan
Copy link
Member

Fixes #1254

@@ -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()));
Copy link
Member

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()) {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what reason?

Copy link
Member

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.

Copy link
Member Author

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

@kenfinnigan kenfinnigan added this to the 0.11.0 milestone Mar 6, 2019
@stuartwdouglas stuartwdouglas merged commit f9673b4 into quarkusio:master Mar 6, 2019
@kenfinnigan kenfinnigan deleted the rest-fix branch March 6, 2019 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants