-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix hibernate-reactive-rest-data-panache when adding smallrye openapi #26074
Conversation
This pull request will generate the rest data methods using the method signature that allows to use parameterized types. Fix quarkusio#25990
import io.quarkus.gizmo.DescriptorUtils; | ||
import io.quarkus.gizmo.MethodCreator; | ||
|
||
public final class SignatureMethodCreator { |
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.
Just checking: we don't already have something like this in Panache, do we?
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.
I could not find something similar in Panache.
We could move it to the gizmo extension or even be part of the ClassCreator API. From my point of view, this is a good candidate for doing it in a second iteration.
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.
Agreed!
This pull request handles the support of parameterized types when creating methods. Example: ```java public List<String> methodName() { } ``` Where `List<String>` is a parameterized type. In order to do this, we need to amend the `signature` of the method as the descriptor does not support it (it says class not found when trying to declare `Ljava.util.List<Ljava.lang.String;>;`). In order to resolve this, we have added a wrapper type `ParameterizedClass` where we can specify the wrapper type and the param types. Usage: ``` MethodCreator method = creator.getMethodCreator("methodName", new ParameterizedClass(List.class, String.class)); ``` This pull request partially resolves: quarkusio#66 (which is intended to be for classes too) Moreover, these changes are inspired by the changes in quarkusio/quarkus#26074 (that there will be deprecated once gizmo dependency is bumped). I've verified these changes in Quarkus upstream too (reverting the changes of the mentioned Quarkus pull request) and it worked fine.
This pull request will generate the rest data methods using the method signature that allows to use parameterized types.
Fix #25990