Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Incremental build failure: the parameter is not bound in [all branches of] pointcut‏

Done:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=286341

Thanks.


Date: Tue, 11 Aug 2009 14:12:50 -0700
Subject: Re: [aspectj-users] Incremental build failure: the parameter is not bound in [all branches of] pointcut‏
From: andrew.clement@xxxxxxxxx
To: aspectj-users@xxxxxxxxxxx

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 <jonathan_w_brown@xxxxxxxxxxx>
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.

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




Windows Live™: Keep your life in sync. Check it out.

Back to the top