Hi Jonathan,
Definetly a bug, and I think you are right that it is the combination of
target(b) and incremental. if you raise a bug I'll take a look:
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
Workarounds for now - well you could try it in code style rather than
annotation style, but I suspect that won't fix it in this case.
You could avoid binding target and instead access it through the
ProceedingJoinPoint via getTarget().
@Pointcut("if() && call(public * somepackage.Behavior.*(..)) &&
target(Behavior)")
public static boolean adviseIfMonitoring() {
public Object monitorBehaviorPerformance(ProceedingJoinPoint pjp) throws
Throwable {
Behavior b = pjp.getTarget();
return pjp.proceed();
incremental comp may be more forgiving on that setup.
Andy
2009/8/10 Jonathan Brown <[email protected]>
> 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.<http://www.bing.com/cashback?form=MSHYCB&publ=WLHMTAG&crea=TEXT_MSHYCB_BackToSchool_Cashback_BTSCashback_1x1>
>
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users