Community
Participate
Working Groups
for given interface/class/aspect ajc v. 1.0.6 produces code that skips instance initialization by inserting 'return' after calling 'after' implementation for interface initialization as shown below: ---------- /* Generated by AspectJ version 1.0.6 */ class A implements IA { Integer a; A() { super(); { aj$label1: if (true) Logging.aspectInstance.before0$ajc(); Logging.aspectInstance.afterReturning0$ajc(((Object)(null))); return; // skipping instance initialization! this.a = new Integer(1); } aj$label0: if (true) Logging.aspectInstance.before0$ajc(); Logging.aspectInstance.afterReturning0$ajc(((Object)(null))); return; } public void doIt() { System.out.println("in do it!"); } } ---------- aspect Logging { pointcut LogIn(): execution(new(..)) && !within(Logging); before (): LogIn() { System.out.println("before"); } after() returning (Object i): LogIn() { System.out.println("after"); } } interface IA { void doIt(); } class A implements IA { Integer a = new Integer(1); A() { } public void doIt() { System.out.println("in do it!"); } }
This bug has been fixed in the 1.1beta releases. Even though this is a very serious bug, it is unlikely that it will be fixed in the 1.0.x branch of the compiler due to lack of time. The source code is available for that branch if you wish to attempt a fix yourself. We expect to have a 1.1 release candidate available in the next couple of weeks and would recommend switching to that version then -- or you could help us test even more by trying the beta3 release that should be out today.