Bug 72032 - compiler or documentation bug about handler join points
Summary: compiler or documentation bug about handler join points
Status: CLOSED INVALID
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-16 12:41 EDT by Ganesh Sittampalam CLA
Modified: 2004-08-18 09:31 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ganesh Sittampalam CLA 2004-08-16 12:41:49 EDT
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");
    }
}
Comment 1 Adrian Colyer CLA 2004-08-18 08:59:41 EDT
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?
Comment 2 Ganesh Sittampalam CLA 2004-08-18 09:17:22 EDT
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?
Comment 3 Adrian Colyer CLA 2004-08-18 09:31:35 EDT
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."