Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] 'around advice a method call under cflow' does not work

This is a fairly complex pointcut.  Just by eyeballing it, it is hard
for me to see what the problem is.  Whenever I am in a situation like
this and I need to find out why a pointcut is not matching, I try
breaking things down into simpler pointcuts and see if they match.

First, are you using AJDT and do you see the gutter annotations in the
places where you expect them to be?

Also, try creating advice for each of your named pointcuts.  In the
body of the advice, print something the sysout.  Once you have all of
your named, component pointcuts working properly, you can then start
combining them to create the pointcut that you actually need.

I hope this helps.

On Tue, Aug 30, 2011 at 8:44 AM, Rice Yeh <riceyeh@xxxxxxxxx> wrote:
> Hi,
>   I have an around advice on a method call pointcut under a cflow. cflow is
> passoing its context to the funciton call. My program is shown in the
> following. However, it does not work like no around advice exists although
> from the byte code I can tell some code is weaved in the function call. What
> is wrong with my program?
>
> aspect FunctionInvocationOnEvaluationStartingObject
> {
>     pointcut evaluation(EvaluationContext context):
>         args(context, *) &&
>         execution(Object Evaluation.evaluate(EvaluationContext, Class));
>
>     pointcut functionInvocation(AstFunction astFunction, Object base, Method
> method):
>         target(astFunction) &&
>         args(*, *, base, method) &&
>         call(Object AstFunction.invoke(Bindings, ELContext, Object,
> Method));
>
>     Object around(EvaluationContext context, AstFunction astFunction, Object
> base, Method method):
>         functionInvocation(astFunction, base, method) &&
>         cflow(evaluation(context)) &&
>         !within(FunctionInvocationOnEvaluationStartingObject)
>     {
>         if (base == null) {
>             for (Method m:
> context.getEvaluationStartingObject().getClass().getMethods()) {
>                 if (m.equals(method))
>                     return proceed(context, astFunction,
> context.getEvaluationStartingObject(), method);
>             }
>         }
>         return proceed(context, astFunction, base, method);
>     }
> }
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top