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 name = "John"; public Child(String name) { this.name = name; } } * As we can see, *Child * extends *Parent* class Parent has a method *getJob()* *public class Parent { private int mJob = 0; public int getJob() { return mJob; } }* If I add a new constructor for the *Child * in my aspect. * public aspect MyTest { public Child.new(String name, int age) { super.getJob();//This seems to cause issues at runtime } }* The above aspect code will trigger an exception. * Exception in thread "main" java.lang.NoSuchMethodError: com.test2.Child.ajc$superDispatch$com_test2_Child$init()V at MyTest.ajc$postInterConstructor$MyTest$com_test2_Child(MyTest.aj:19) at com.test2.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:11)* *Is this a limitation of AspectJ? Is this the only way to resolve this issue?* *My workaround:* Define* another wrapper method* for class *Child*, and indirectly call the *super.getJob() * via that wrapper method For example, use ITD to add a new method for class *Child* public int Child.getJobWrapper() { super.getJob(); } Now, I can call *getJobWrapper*() from the newly added constructor like below: public aspect MyTest { public Child.new(String desc, int num) { *this.getJobWrapper();* //This will help me call the getJob() in super class } } Thank you all for your time :) -- View this message in context: http://aspectj.2085585.n4.nabble.com/ITD-constructor-access-methods-defined-in-super-class-tp4651029.html Sent from the AspectJ - users mailing list archive at Nabble.com. _______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/aspectj-users