Bug 110162 - compilation error with declared generic field (java 1.5)
Summary: compilation error with declared generic field (java 1.5)
Status: RESOLVED WORKSFORME
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M3   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 1.5.0RC1   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-21 08:32 EDT by Casier Koen CLA
Modified: 2005-11-03 06:49 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Casier Koen CLA 2005-09-21 08:32:04 EDT
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.
Comment 1 Andrew Clement CLA 2005-09-21 08:59:33 EDT
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) ?
Comment 2 Casier Koen CLA 2005-09-21 09:05:15 EDT
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.

Comment 3 Andrew Clement CLA 2005-09-21 09:29:58 EDT
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?
Comment 4 Casier Koen CLA 2005-09-21 09:43:19 EDT
I'm not using the incremental compilation mode of the iajc-task.
I'm doing a fresh build every time.


Comment 5 Andrew Clement CLA 2005-10-28 03:37:31 EDT
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>"
Comment 6 Adrian Colyer CLA 2005-10-28 07:11:40 EDT
marking for 1.5.0RC1 resolution (old target was out of date)
Comment 7 Andrew Clement CLA 2005-11-03 06:49:09 EST
closing as probably already fixed - I certainly can't recreate it.  Please
reopen if its still a problem for you.