flow-development-collection: Pointcut method designator does not allow to intercept private methods
Description
Pointcut method designator does not allow to intercept private methods, only protected or public methods can be intercepted.
This is actually somewhat documented at https://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartIII/AspectOrientedProgramming.html#method
since it only mentions public and protected methods but not private methods.
Steps to Reproduce
- create a class with a private method that is called.
- Create an Aspect with an annotation like
@Flow\AfterReturning("method(Foo\Bar\Service\MyService->getResponse())")
pointing to the private method.
Expected behavior
The Aspect to be called when the private method returns something.
Actual behavior
Nothing happens.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (16 by maintainers)
Commits related to this issue
- BUGFIX: Disallow advising of private methods Intercepting private methods does not work since the original method is no longer accessible if it is overridden in the proxy class. But it was still pos... — committed to bwaidelich/flow-development-collection by bwaidelich 4 years ago
- BUGFIX: Disallow advising of private methods Intercepting private methods does not work since the original method is no longer accessible if it is overridden in the proxy class. But it was still pos... — committed to bwaidelich/flow-development-collection by bwaidelich 4 years ago
right, grrrr 😉
@albe I finally came around to take a closer look on to your implementation (#2035) but I couldn’t get it to work.
So I recreated my fix (#2131) with the
5.3
target branch, tweaked it a little, copied some of your exception message and added doc comments…Hey guys, how should we proceed with this one?
I would consider #2036 (or #2035) an improvement to the current situation. We could always still add support for proxied private methods if we figure out a good way to implement this. Personally, I won’t take care of that because I still think that it should™ not be required. But obviously I’d be happy if someone else took care. Otherwise I’d go ahead an add documentation and tests to my PR
You are correct 😃
Repeating myself just to get the point across 😃