Community
Participate
Working Groups
Created attachment 138951 [details] Testcase Build ID: M20090211-1700 AspectJ 1.6.5 See the attached test case. When there are two generic intertype methods defined in an aspect, and one calls the other: public void SelectAction<I, T>.setSelected(T object){ //do nothing } public void SelectAction<I, T>.setSelectedId(I id){ setSelected(null); } Then the implementing class overrides the called method: public class Test implements SelectAction<Long, User>{ public void setSelected(User user){ //overriden version } public static void main(String[] args){ new Test().setSelectedId(1l); } } A call to setSelectedId will result in: Exception in thread "main" java.lang.AbstractMethodError: Test.setSelected(Ljava/lang/Object;)V at SelectActionAspect.ajc$interMethodDispatch1$SelectActionAspect$SelectAction$setSelected(SelectActionAspect.aj) at SelectActionAspect.ajc$interMethod$SelectActionAspect$SelectAction$setSelectedId(SelectActionAspect.aj:13) at Test.setSelectedId(Test.java:1) at Test.setSelectedId(Test.java:1) at SelectActionAspect.ajc$interMethodDispatch1$SelectActionAspect$SelectAction$setSelectedId(SelectActionAspect.aj) at Test.main(Test.java:13)
Created attachment 138977 [details] Patch for weaver module I can see where the problem is (thanks for the testcase) but it is quite a disruptive fix. There are 3 problems in there: - we look at the raw type 'SelectAction' to see if it has intertypes on it. It doesn't have because they are on the generic type backing the raw type - once we find those, we only deal with erasures to discover with parameters 'match' - this doesn't allow for plain old methods that just override and are nothing to do with generics (so we have problems with 'T extends Object' and 'User' in this testcase) - once we are past *that* we mess up looking at the return type the attached patch causes your test program to pass but breaks some other code. Due to the disruptive nature of the change, I think I'll wait until 1.6.5 is out and fix this properly in early 1.6.6 builds.
Works for me. In the meantime, if anyone else runs across this issue, the workaround I'm using is to create an abstract superclass, implement the ITD interfaces in that superclass so that the bridge methods are inherited, and then place the overriden method in the subtype. So the above becomes: public abstract class AbstractTest implements SelectAction<Long, User>{ } public class Test extends AbstractTest{ public void setSelected(User user){ //overriden version } }
patch reworked and committed.