Apologies in advance; I'm sure there is a more concise problem description but I'll let the expert eyes figure that one out.
I'm using Eclipse 3.5 and AJDT 2.0.1.e35x-20090717-0900 / aspectj 1.6.5.20090618034232
Project organization is as follows:
Bundle A contains a bunch of interfaces
- In this case that would be 'somepackage.Behavior'
Bundle B contains my aspect and references the interfaces exported by Bundle A
- See details below
Bundle C contains a class the code the pointcut matches
Here is an approximation of my pointcut:
@Pointcut("if() && call(public * somepackage.Behavior.*(..)) && target(b)")
public static boolean adviseIfMonitoring(Behavior b) {
return true;
}
Ditto the advice:
@Around("adviseIfMonitoring(b)")
public Object monitorBehaviorPerformance(ProceedingJoinPoint pjp, Behavior b) throws Throwable {
return pjp.proceed();
}
Bundles C has an ajnature added and has Bundle B [project] added to its aspectpath.
Following a clean build everything seems fine. The compiled code has
the aspect woven and the IDE highlights the application of the advice
at the correct joinpoints in Bundle C.
However, if I make any change to a class in Bundle C, specifically the
class for which the advice is applied to, I get a compilation error
from the aspect in Bundle B: "the parameter pjp is not bound in [all
branches of] pointcut."
If I clean Bundle B the problem is resolved and everything works again.
The problem *appears* to be related to the use of the target(b) portion
of the pointcut in conjunction with incremental compilation.
Any suggestions other than 'Don't do that'?
Thanks in advance,
Jonathan
Get back to school stuff for them and cashback for you.
Try Bing now.