Project: AspectJ
Bug 413378 A constructor added by ITD cannot invoke the method of its super class
Reported: 2013-07-20 02:22:28 | Status: resolved fixed

AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files

Files changed in fix:
tests/bugs174/pr413378/Code.java tests/src/org/aspectj/systemtest/AllTests17.java tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java tests/src/org/aspectj/systemtest/ajc174/AllTestsAspectJ174.java weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java