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

Log warning for usage of argNames attribute in AspectJ annotations #30055

Closed
sbrannen opened this issue Mar 1, 2023 · 2 comments
Closed

Log warning for usage of argNames attribute in AspectJ annotations #30055

sbrannen opened this issue Mar 1, 2023 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement

Comments

@sbrannen
Copy link
Member

sbrannen commented Mar 1, 2023

Since the introduction of the java.lang.reflect.Parameter API in Java 8, the argNames attributes in AspectJ annotations (such as @Before, @Around, etc.) are no longer necessary.

Instead, the Spring team suggests that code be compiled with the javac -parameters flag to make the parameter names available in the compiled byte code.

In light of that recommendation, we should log a warning any time we detect an explicit argNames attribute declaration in an AspectJ annotation.

@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Mar 1, 2023
@sbrannen sbrannen self-assigned this Mar 1, 2023
@sbrannen sbrannen changed the title Log warning for usage of argNames attributes in AspectJ annotations Log warning for usage of argNames attribute in AspectJ annotations Mar 1, 2023
@sbrannen sbrannen added this to the 6.0.7 milestone Mar 1, 2023
@sbrannen
Copy link
Member Author

sbrannen commented Mar 1, 2023

@sbrannen
Copy link
Member Author

sbrannen commented Mar 3, 2023

Since argNames attributes are checked first in the ParameterNameDiscover chain (technically before the chain), using argNames can avoid potentially more costly operations in the chain.

In light of that we have decided not to log a warning and instead to recommend the use of -parameters as can be seen in the updated Determining Argument Names and Explicit Argument Names sections of the reference manual.

@sbrannen sbrannen closed this as not planned Won't fix, can't repro, duplicate, stale Mar 3, 2023
@sbrannen sbrannen removed this from the 6.0.7 milestone Mar 3, 2023
@sbrannen sbrannen added the status: declined A suggestion or change that we don't feel we should currently apply label Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant