Skip to main content

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

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);
    }
}


Back to the top