Thursday, May 15, 2008

AspectJ: A crucial distinction between execution and call join points

Given the following code:


class Super {
protected void m() {}
}
class Sub extends Super {}


A call( * Sub+.m( .. ) ) join point will match any call to m made on an instance statically known to be a Sub (in particular, ( ( Super )s ).m() will not only not match, but will cause a compiler warning); an execution( * Sub+.m() ) join point will not match s.m(), even if s is Sub, because there's no m() code to execute in Sub!

No comments: