Community
Participate
Working Groups
Hello, I have one project which contains one class, the output of this project is on the classpath of the next. package de.aspectsoft.tests.subclasses; import de.aspectsoft.tests.coretest.CoreObject; /** * @author Arno Schmidmeier * */ public class SubClassDemo extends CoreObject { public static void main(String[] args) { new SubClassDemo().foo(); new SubClassDemo().toString(); new MySubClass().foo(); new MySubClass().toString(); } } And a second project with the classes: package de.aspectsoft.tests.subclasses; /** * @author Arno Schmidmeier * */ public aspect SubClassDemoAspect { before():execution(public * SubClassDemo.*(..)){ System.out.println("SubClassDemo+ execution(public * SubClassDemo.* (..))"+thisJoinPoint); } before():execution(* *.*(..))&&this(SubClassDemo){ System.out.println("SubClassDemo+ execution(* *.*(..))&&this (SubClassDemo))"+thisJoinPoint); } before():execution(public * MySubClass.*(..)){ System.out.println("SubClassDemo+ execution(public * SubClassDemo.* (..))"+thisJoinPoint); } before():execution(* *.*(..))&&this(MySubClass){ System.out.println("SubClassDemo+ execution(* *.*(..))&&this (SubClassDemo))"+thisJoinPoint); } } package de.aspectsoft.tests.subclasses; /** * @author Arno Schmidmeier * */ public class MyCore { public void foo(){ } } package de.aspectsoft.tests.subclasses; /** * @author Arno Schmidmeier * */ public class MySubClass extends MyCore{ } Runing the second project generates following output. SubClassDemo+ execution(public * SubClassDemo.*(..))execution(void de.aspectsoft.tests.subclasses.SubClassDemo.main(String[])) SubClassDemo+ execution(* *.*(..))&&this(SubClassDemo))execution(void de.aspectsoft.tests.subclasses.MyCore.foo()) There are several execution Joinpoints missing. e.g. all executions of to .toString() e.g. the execution of SubClassDemo.foo(); Plattform AspectJ 1.1.6 form Ajdt 1.1.6 (development branch) eclipse 2.1.1, windows XP and jdk 1.3 If you have some additional questions please do not hesitate to ask me.
AspectJ 1.1 behaves in the same way.
It looks to me that your program is being handled correctly by AspectJ-1.1.1 and I'd be surprised if this same program compiled in the same way would behave any differently under AspectJ-1.0.x. Can you show what the output is that you get from AspectJ-1.0.x (specifying exactly which version) for compiling EXACTLY this same code?
I'm going to close this bug (reopen if it is still a problem). execution() advice can only be affected on methods/ctors declarations that are given to the AspectJ compiler for weaving. In the code sample in the initial bug report, the toString() is not implemented in any of the code we can see, so presumably it is defaulting to using the toString() implementation on java.lang.Object. As java.lang.Object is not usually woven by the compiler, it cannot affect advice that matches on execution() of toString(). (the join point for execution() of toString() was never available for matching). Similarly I can't see the implementation of SubClassDemo().foo() so the join point is probably not available for matching against execution() advice. To match on the toString() or foo() calls - use call() PCD instead.
Fix released as part of AspectJ 1.2.1