Bug 171952 - introduction of generic methods on interfaces leads to compilation errors
Summary: introduction of generic methods on interfaces leads to compilation errors
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.3   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 1.5.4   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-28 16:40 EST by Vincenz Braun CLA
Modified: 2007-10-10 10:22 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vincenz Braun CLA 2007-01-28 16:40:29 EST
Take
---------
import java.util.List;

public interface Foo {

	<T> List<T> createList();
}
---------
and
---------
import java.util.ArrayList;
import java.util.List;

public aspect FooAspect {


	public <T> List<T> Foo.createList() {
		return new ArrayList<T>();
	}
}
---------
compiling with ajc results in the following error message:
FooAspect.aj:9 [error] can't override java.util.List<T> Foo.createList() with java.util.List<T> Foo.createList() return types don't match
public <T> List<T> Foo.createList() {
                       ^^^^^^^^^^
Foo.java:7 [error] can't override java.util.List<T> Foo.createList() with java.util.List<T> Foo.createList() return types don't match
<T> List<T> createList();
            ^^^^^^^^^^

2 errors
Comment 1 Andrew Clement CLA 2007-01-30 04:36:39 EST
the bug occurs because in ResolvedType.checkLegalOverride the return types List<T> for the parent and List<T> for the child are difference instances of a ReferenceType and == equality is used to determine compatibility.
Comment 2 Vincenz Braun CLA 2007-02-06 07:35:24 EST
Normally I let the owner change the severity of reported bugs. 
We stumble about this bug very regularly and as a workaround we have to change
our interfaces to make some progress. Changes that later have to be taken back.
We sometimes forgot to work around this bug and unfortunately ajdt can sometimes
under unknown circumstances compile similar code. But compiling the whole project 
containing similar code like this with maven2 regularly fails. So we find missing
workaraounds very late. When is the next maintainance release for ajdt and apsectj scheduled?
I have the feeling its "conference time" and work on both is suspended.
This bug seems easy to fix. Can it be incorporated in the next release?

So I would like the severity raised to critical.
Comment 3 Andrew Clement CLA 2007-02-07 04:15:10 EST
fix committed
Comment 4 Vincenz Braun CLA 2007-02-07 06:55:56 EST
Thank you very much!
Comment 5 Andrew Clement CLA 2007-02-21 03:42:38 EST
fix available in latest AJ dev build.
Comment 6 Eclipse Webmaster CLA 2007-07-29 09:21:35 EDT
Changing OS from Mac OS to Mac OS X as per bug 185991