Date:2008-02-15 18:22
Priority:3
Submitted By:Dean Wampler (deanwampler)
Assigned To:Dean Wampler (deanwampler)
Category:None
State:Open
Summary:Need a mechanism to suspend advice execution, especially during advice itself
Detailed description
A common problem in aspects is infinite recursion when the advice for a method calls the method, which invokes the advice for the method, ad infinitum. AspectJ handles this with several pointcut designators, e.g., !within(MyAspect) or !cflowbelow(adviceexecution()), etc.
While I want to add these sorts of designators eventually, it might be nice to add something more "rubyish" such as the following:
aspect :before, :calls_to => doit, :on_type => Foo do |jp, object, *args|
jp.while_suspending_advice do
value = object.foo(args)
...
end
end
JoinPoint#while_suspending_advice might take an optional list of JoinPoints, where if blank, all advices for all JoinPoints are bypassed, but if JPs are specified, only those are suspended within the block.
Note that this facility is only required for the general case where advice wants to call arbitrary methods that may have advice. If the advice just wants to call the same method that it is advising, there is already a workaround;
call jp.invoke_original_join_point.
Date:2008-02-15 18:22 Priority:3 Submitted By:Dean Wampler (deanwampler) Assigned To:Dean Wampler (deanwampler) Category:None State:Open Summary:Need a mechanism to suspend advice execution, especially during advice itself
Detailed description
A common problem in aspects is infinite recursion when the advice for a method calls the method, which invokes the advice for the method, ad infinitum. AspectJ handles this with several pointcut designators, e.g., !within(MyAspect) or !cflowbelow(adviceexecution()), etc.
While I want to add these sorts of designators eventually, it might be nice to add something more "rubyish" such as the following:
JoinPoint#while_suspending_advice
might take an optional list of JoinPoints, where if blank, all advices for all JoinPoints are bypassed, but if JPs are specified, only those are suspended within the block.Note that this facility is only required for the general case where advice wants to call arbitrary methods that may have advice. If the advice just wants to call the same method that it is advising, there is already a workaround; call jp.invoke_original_join_point.