-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Annotate CGLIB Transformer interface with @FunctionalInterface
#35823
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
Annotate CGLIB Transformer interface with @FunctionalInterface
#35823
Conversation
Signed-off-by: behappyleee <72903623+behappyleee@users.noreply.github.com>
0dabdf6 to
f3d90b3
Compare
|
@behappyleee do you have a particular use case needing this change? Can you share a code snippet of what you are trying to achieve? I am asking because this code is being shaded in spring and only apply strictly necessary patches there. |
@bclozel The reason I applied this change is that I wanted to use Transformer as a functional interface in a small utility module, mainly for passing lambda expressions. Nothing beyond this is required on Spring’s side, and there’s no need for any additional patches in the shaded code. If this causes any concern, feel free to point it out — I can adjust my approach accordingly. Here’s a small snippet showing how I intended to use the Transformer interface as a functional interface: Thanks again for the clarification! |
|
@jhoeller do you think it's worth applying this change to our cglib fork? It's adding maintenance cost so we must consider the tradeoffs here. |
Transformer interface with @FunctionalInterface
In that example, it appears that you are using Whereas, as far as I know, And I don't consider that to be a supported use case with Spring's fork of CGLIB. Instead, if you want to use something like In summary, I don't see any value in annotating |
|
Closing due to the rationale provided in #35823 (comment). |
|
Thank you for the clarification and for pointing me in the right direction. I appreciate it. |
Summary
Add the
@FunctionalInterfaceannotation toTransformer.Details
Transformeralready has a single abstract method, so marking it as a functional interface clarifies its intended use and provides better compile-time checks and IDE support.Compatibility
No behavior changes; fully backward-compatible.