-
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
Copy default methods of a RestClient Reactive interface to the generated class #21692
Copy default methods of a RestClient Reactive interface to the generated class #21692
Conversation
Thanks for your pull request! The title of your pull request does not follow our editorial rules. Could you have a look?
|
Draft because we need quarkusio/gizmo#93 merged and released first. |
…ted class RestClient Reactive generates a `...$$CDIWrapper` class for each RestClient interface, and creates an implementation of each RestClient method. This leaves non-RestClient methods (`default` methods) on the interface, which means that if they are annotated with an interceptor binding, the interceptor is not invoked. This is because interceptor bindings are not inherited from superinterfaces, only from superclasses (and while ArC has some support for intercepting `default` methods from superinterfaces, it doesn't extends that far). This PR doesn't attempt to support intercepting `default` methods in general, because that's a gray area. Instead, it fixes how RestClient Reactive generates the class for a RestClient interface (because RestClient interfaces are special in that they may define class-based beans if annotated `@RegisterRestClient`). In addition to RestClient methods, `default` methods from the RestClient interface are also copied to the generated class. (The "copy" delegates to the `default` method inherited from the superinterface, which had to be added to Gizmo, hence the Gizmo update.) That itself is enough for interceptors to start working.
a0ab2e6
to
6b19e71
Compare
Rebased and marked ready for review, as Quarkus was updated to use Gizmo 1.0.10.Final. |
Do we want to backport this to |
Good point, I think we should. Added a label. |
CC @edeandrea |
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.
that's cool! Thanks @Ladicek !
RestClient Reactive generates a
...$$CDIWrapper
class for eachRestClient interface, and creates an implementation of each
RestClient method. This leaves non-RestClient methods (
default
methods) on the interface, which means that if they are annotated
with an interceptor binding, the interceptor is not invoked.
This is because interceptor bindings are not inherited from
superinterfaces, only from superclasses (and while ArC has some
support for intercepting
default
methods from superinterfaces,it doesn't extends that far).
This PR doesn't attempt to support intercepting
default
methodsin general, because that's a gray area. Instead, it fixes how
RestClient Reactive generates the class for a RestClient interface
(because RestClient interfaces are special in that they may define
class-based beans if annotated
@RegisterRestClient
). In additionto RestClient methods,
default
methods from the RestClientinterface are also copied to the generated class. (The "copy"
delegates to the
default
method inherited from the superinterface,which had to be added to Gizmo, hence the Gizmo update.) That itself
is enough for interceptors to start working.
Fixes #21674