Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358024 - Phantom compiler error when introducing a base class with generic type argument
Summary: Phantom compiler error when introducing a base class with generic type argument
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: 2.1.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.2.0   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-18 09:11 EDT by Stefan Ocke CLA
Modified: 2012-05-09 13:37 EDT (History)
2 users (show)

See Also:


Attachments
Sample Project (5.03 KB, application/binary)
2012-05-06 03:35 EDT, Stefan Ocke CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Ocke CLA 2011-09-18 09:11:44 EDT
Build Identifier: 20110615-0604

AspectJ Development Tools 2.1.3.e37x-20110628-1900	

When an ITD introduces a base class B<T> for a class A, that has a type argument, and that base class implements an interface InterfaceB<T> with a type argument, there is a "phantom" compiler error when trying to assign an instance of A to a variable of type IntefaceB<T>. That is, the compiler error only appears in the AspectJ/Java editor window, but not in the list of problems. (the project compiles sucessfully).
The error message says: "Type mismatch ..."
Note: If I remove the type argument, the phantom error disappears.

Reproducible: Always

Steps to Reproduce:
public interface InterfaceB<T> {}

public class B<T> implements InterfaceB<T> {}

public class A {}

public aspect AspectForA {
	declare parents: A extends B<String>;
}

public class Main {
	void phantomError(){
		InterfaceB<String> b = new A(); //Here, the phantom error occurs.
	}
}
Comment 1 Andrew Eisenberg CLA 2012-02-29 19:25:42 EST
Thanks for the bug report.  I have reproduced and found the problem.  When augmenting the types during a reconcile, we were not properly handling  generics.  I will create some tests and commit the fix.
Comment 3 Stefan Ocke CLA 2012-05-06 03:31:30 EDT
Hello Andrew,

I just installed

AJDT    2.2.0.e37x-20120427-1300	

on a fresh Eclipse 3.7.2.

But the phantom error is still there...
Comment 4 Stefan Ocke CLA 2012-05-06 03:35:16 EDT
Created attachment 215139 [details]
Sample Project

Please open Main.java to see the phantom error in the editor.
Comment 5 Andrew Eisenberg CLA 2012-05-06 11:37:31 EDT
Hmmm....I'll have another look.
Comment 6 Andrew Eisenberg CLA 2012-05-07 16:09:12 EDT
Looks like I was testing for a variant of the project that you supplied.  In this case, all the classes were in the same file.  The previous commit covered that bug.  I have made a new commit that addresses the original problem described in this bug report.

Committed the following changes to the E37 and master branches:

http://git.eclipse.org/c/ajdt/org.eclipse.ajdt.git/commit/?h=E37&id=9ef4ab32f09df7da0359fd8ccf576e204275c1c4

http://git.eclipse.org/c/ajdt/org.eclipse.ajdt.git/commit/?id=b960b872a61e0c6b28e5bd4e8d7c66c5ada3141d

This will be available on the E42 and E37 branches once the CI server creates the build in a few hours.  Please let me know if you get a chance to try this out.
Comment 7 Stefan Ocke CLA 2012-05-09 13:37:10 EDT
Works as expected, now. Thanks.