Community
Participate
Working Groups
When compiling the following code (considering the fact that there is a class called somepackage.SomeClass), gives the following compiler-error: COMPILER-ERROR: Type mismatch: cannot convert from ArrayList<Integer> to List<E> ASPECT-CODE: public aspect TestAspect { private List<Integer> somepackage.SomeClass.list; public void somepackage.SomeClass.newMethod(){ this.list = new ArrayList<Integer>(); } } This error is shown when compiling in eclipse using the latest aspectj-version, as well as when running an ant-build using aspectj-1.5M2.
This code works for me *if* the type being ITD'd upon is in the same file as the aspect: import java.util.*; class A {} public aspect TestAspect { private List<Integer> A.list; public void A.newMethod(){ this.list = new ArrayList<Integer>(); } } then I moved A to a second file, it still works, then I moved A to a difference package and it still worked. Can I ask if were you applying the aspect to somepackage.SomeClass.class *or* was all the source being compiled together (SomeClass and TestAspect) ?
I am compiling all source-files (.java and .aj) using an ant-build script which is incorporated in continuous building cycle, and the ant-build gives me the same compiler error.
hello again. Just one more clarification, when you say: "using an ant-build script which is incorporated in continuous building cycle" Do you mean you are using the incremental compilation feature built into the iajc task? (with incremental being true and sourceroots being specified) or is the iajc task invoked afresh for each compile as part of some larger incremental build process?
I'm not using the incremental compilation mode of the iajc-task. I'm doing a fresh build every time.
Are you able to try recreating this problem on a recent dev build of AspectJ? We've modified a lot of generics support since this was reported and I've fixed quite a few things related to this kind of thing "Type mismatch: cannot convert from ArrayList<Integer> to List<E>"
marking for 1.5.0RC1 resolution (old target was out of date)
closing as probably already fixed - I certainly can't recreate it. Please reopen if its still a problem for you.