Search code examples
javaaspectjcontrol-flow

How is the AspectJ cflow pointcut implemented?


How does AspectJ check if the execution is happening in the control flow of, say, a method? It could be a very useful insight, to be able to implement the functionality on its own, outside of an AspectJ project.

Your help will be appreciated.


Solution

  • I found out by myself :-)
    AspectJ uses a ThreadLocal variable to keep track of the control flow.
    Source: AspectJ's own FAQ