Local Variables in AspectJ

2019-08-18 21:05发布

问题:

I'm implementing an invariants extension to the java language. I'm implementing the parser for my new language and annotated AST as an intermediate representation. Now I'm thinking of using AspectJ to control where to inject code in a visit to AST to control the variables but I detect a problem. AspectJ doesn't have a joinpoint to local variables. Is there any extension to aspectj or other aspect programming framework with this functionality?

Regards

回答1:

Local variable access is not exposed as a joinpoint in AspectJ, and I do not know of any extension to AspectJ to do that.

Maybe lower-level bytecode instrumentation libraries like ASM could be helpful in your case. With ASM you can work on JVM byte code level.