Community
Participate
Working Groups
Build ID: 20090619-0625 Steps To Reproduce: 1. Compile following code in Eclipse: public class Test { void doStuff(IGenericReference<? extends ISpecificReference> reference) { new Delegate().doStuff(reference); } } class Delegate { void doStuff(IGenericReference<? extends ISpecificReference> reference) { } } interface IGenericReference<T extends IGenericReference<T>> {} interface ISpecificReference {} 2. Compile same code with Sun javac -> error 3. Eclipse should be able peak the problem with ISpecificReference (it is not extending IGenericReference) More information:
(In reply to comment #0) > 2. Compile same code with Sun javac -> error I don't see any error when compiling with Sun javac. I have javac 1.6.0_13, which version were you using?
Indeed, it compiles on 1.6.0_14. The error appears for sure on 1.5.0_12 and on 1.5.0_19: javac -version Test.java javac 1.5.0_19 Test.java:3: doStuff(IGenericReference<? extends ISpecificReference>) in Delegate cannot be applied to (IGenericReference<capture of ? extends ISpecificReference>) new Delegate().doStuff(reference); ^ 1 error Code is unfortunatelly quite complicated, not sure now if it was a genuine error in eclipse compiler. If you don't see any problem with code, please resolve the bug (as invalid, I guess).
OK, slightly modified code doesn't compile on 1.6.0_14, but still compiles on eclipse: public class Test { void doStuff(GenericReference<? extends SpecificReference> reference) { new Delegate().doStuff(reference); } } class Delegate { void doStuff(GenericReference<? extends SpecificReference> reference) { } } class GenericReference<T extends GenericReference<T>> {} class SpecificReference {} Logically, it looks like 1.6 working correct. In previous version SpecificReference was an interface and it was possible for some type to implement both Specific and Generic one (1.5 has not accounted for that), but for classes it is not possible (eclipse compiler has not accounted for that).
Sorry, ignore previous posting eclipse compiler works in the same way as Sun 1.6 Problem is only on 1.5 versions.
Compiles fine with javac 6 & 7, and eclipse Believe this was a bug in 1.5
Verified for 3.6M1