Community
Participate
Working Groups
Appendix C of the programming guide states "In general, cflow(handler(Type)) will pick out no join points." This is not true, since ajc weaves a push and pop to the relevant cflow stack around any before advice that applies at a handler joinpoint. So within that advice, cflow(handler(...)) will apply. The following program demonstrates this. Either ajc or the documentation should be fixed to correspond to the other. [tested with 'DEVELOPMENT built on Monday Aug 16, 2004 at 13:50:47 GMT'] public class HandlerCflow { public static void main(String[] args) { try { throw new Exception("foo"); } catch(Exception e) { } } public static void beforehandler() { } } aspect HCAspect { before() : handler(Exception) { HandlerCflow.beforehandler(); } before(): execution(void HandlerCflow.beforehandler()) && cflow(handler(Exception)) { System.out.println("in handler cflow"); } }
Appendix C of the programming guide states, "***In General***, cflow..." (highlights mine). In the general case, this is true and the documentation is correct (and quite distinct from cflow(...) NEVER matches any join points). Your example program does indeed highlight one of the non-general cases (the only one that I can think of?), but I don't agree that there is a bug here. Both the documentation and the compiler are correct. If you found this problem in a real program and were confused by ajc's behavior then I might be swayed to add some additional text to the docs, but failing that I think explicitly calling out this case is more likely to add distracting noise than to contribute to overall understanding?
I think there are two possible meanings of "in general" in this context - the one I was understanding was that it mean the following statement was a generalization of the previous statements (some specific example of handler inside cflow having no effect, that is also technically incorrect for the same reason). Perhaps it could be reworded to say "in general (with some rarely encountered exceptions)" to make the meaning clear?
Yep, thanks for pushing back on this. Looking at the full context I can see the confusion, and I've updated the docs to read: "In general, cflow(handler(..... )) will not pick out any join points, the one exception to this is join points that occur during the execution of any before advice on the handle."