Bug 162991 - [1.5][compiler] Name clash reported for (correct) eclipse-generated code
Summary: [1.5][compiler] Name clash reported for (correct) eclipse-generated code
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.2.2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 167268 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-10-31 16:15 EST by Iain Matcham CLA
Modified: 2007-01-15 12:57 EST (History)
4 users (show)

See Also:


Attachments
Proposed patch for 3.2.2 (954 bytes, patch)
2007-01-08 09:32 EST, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Iain Matcham CLA 2006-10-31 16:15:50 EST
Eclipse build M20060921-0945

For the following three sources:
----Something.java----
public interface Something {
	
}
----Doing.java----
public interface Doing {
	public <S extends Something, T extends S> T get(Class<S> clazz);
}
----DoingImpl.java----
public class DoingImpl implements Doing {
	public <S extends Something, T extends S> T get(Class<S> clazz) {
		// TODO Auto-generated method stub
		return null;
	}
}
----end----
a 'Name clash' error is raised by eclipse, (despite this being eclipse generated code).  Eclipse 3.1 & javac 1.5.0_03 both compile this code successfully.  

Incidentally the problem appears to resolve inconsistently if the Doing and DoingImpl are written as inner classes of Something.
Comment 1 Olivier Thomann CLA 2006-11-01 09:46:42 EST
Reproduced with 3.2 maintenance stream.
This seems to be a incremental build problem.
If a full build is done, no error is reported.
If I make a change in DoingImpl and recompile, then an error (name clash) is reported.
Comment 2 Olivier Thomann CLA 2006-11-01 10:14:50 EST
Same bug in HEAD.
I'll prepare a regression test in GenericTypeTest.
Comment 3 Olivier Thomann CLA 2006-11-01 10:22:01 EST
Added disabled regression tests in org.eclipse.jdt.core.tests.compiler.regression.GenericTypeTest. test1067/1068.
1067 checks the full build scenario and 1068 check the incremental build scenario.
Comment 4 Maxime Daniel CLA 2006-11-07 04:28:14 EST
Enabled test1067, which passes.
test1068 shows that the problem comes from the binary type binding for S (type parameter declared as S extends Something) being marked with AccInterface - which the matching source type binding of test1067 is not. This happens in BinaryTypeBinding#initializeTypeVariable. This results into the method bindings being considered as incompatible since one of the type parameters is an interface (binary) while the other is a class (source).
Comment 5 Kent Johnson CLA 2006-12-11 16:21:10 EST
*** Bug 167268 has been marked as a duplicate of this bug. ***
Comment 6 Philipe Mulet CLA 2007-01-08 09:31:52 EST
Setting the AccInterface bit is indeed a mistake (leftover from some early days). 
Removed the offending bit setting, enabled test GenericTypeTest#test1068.

Comment 7 Philipe Mulet CLA 2007-01-08 09:32:19 EST
Created attachment 56552 [details]
Proposed patch for 3.2.2
Comment 8 Philipe Mulet CLA 2007-01-08 09:33:37 EST
Maxime - pls add a regression test for the dup bug 167268.
Comment 9 Philipe Mulet CLA 2007-01-08 09:52:34 EST
Released for 3.2.2.
Comment 10 Philipe Mulet CLA 2007-01-08 09:56:06 EST
Released for 3.3M5.
Fixed
Comment 11 Eric Jodet CLA 2007-01-15 08:44:42 EST
verified for 3.2.2 using build M20070112-1200