-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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 @Aspect
perthis
syntax in reference manual
#29998
Conversation
perthis
aspect syntax in user manual
perthis
aspect syntax in user manualperthis
@Aspect
syntax in reference manual
perthis
@Aspect
syntax in reference manual@Aspect
perthis
syntax in reference manual
Hi @kriegaex,
It turns out that the examples are correct as-is. To ensure that this works as expected, I pushed some changes to the tests in commit b437b7b. However, I can understand the confusion if one jumps to a particular example in the AOP chapter without having read the Sharing Common Pointcut Definitions section. So we may possibly reconsider our use of shared pointcuts in subsequent examples or possibly cross reference the Sharing Common Pointcut Definitions section. See #30003. In light of that, I am closing this PR. As a side note, your PR made me realize that our So thanks for bringing that to my attention! 👍 |
@sbrannen, I am sorry to have missed that. I even think, it happened for the second time within two or so years when trying to help someone on Stack Overflow. Actually, in my own experience it is a rather rare case to refer to pointcuts defined in a class other than the current aspect or one of its parents and requiring a fully qualified pointcut method name, even though perfectly fine as a development practice. Unfortunately, it makes reading the manual section in question misleading. When just looking for how to use I am not an AOP newbie. In fact, I am the current maintainer of AspectJ and still missed that. Chances are that other users will miss it, too. Would you mind me modifying the PR to mention the fact that you are referring to a pointcut defined in another class here, and maybe also provide a brief example of an inline pointcut? Update: Having followed the links to the newly created issues, I am quite pleased with the fact that you agree that as-is the examples are counter-intuitive and you are planning to do something about it, especially with regard to the extensive use of shared pointcuts in introductory sample code. I really think that inline pointcuts should be used there, or maybe code comments mentioning the fact that you are referring to shared pointcuts would suffice. If you would like me to contribute in order to expedite an update, please let me know. |
In the Spring AOP manual, the sample code falsely reads in both Java and Kotlin examples as follows:
But inside
perthis
must be a valid pointcut, not just a method name, as I explained in this StackOverflow answer.Thus, the example code should be changed to something like:
@sbrannen, maybe you are the right person to review and merge this issue.