Community
Participate
Working Groups
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.
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.
Same bug in HEAD. I'll prepare a regression test in GenericTypeTest.
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.
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).
*** Bug 167268 has been marked as a duplicate of this bug. ***
Setting the AccInterface bit is indeed a mistake (leftover from some early days). Removed the offending bit setting, enabled test GenericTypeTest#test1068.
Created attachment 56552 [details] Proposed patch for 3.2.2
Maxime - pls add a regression test for the dup bug 167268.
Released for 3.2.2.
Released for 3.3M5. Fixed
verified for 3.2.2 using build M20070112-1200