Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: 1. Create three classes: --- package a; public class A<I extends B> { } --- package a; public class B { } --- package a; public class C { public <I extends B, C extends A<I>> A<I> foo(Class<C> clazz) { A<I> ret = bar("bla"); return ret; } public <I extends B, C extends A<I>> A<I> bar(String clazzName) { return null; } } --- 2. Eclipse doesn't give any compilation error 3. if you try to compile class C with javac (I tried both 1.5.0_15 and 1.6.0_05) I get the following error: src\a\C.java:7: incompatible types; inferred type argument(s) I,java.lang.Object do not conform to bounds of type variable(s) I,C found : <I,C>a.A<I> required: a.A<I> A<I> ret = bar("bla"); ^ More information: I know this code is silly and debatable (it has been changed after seeing this compilation error in javac! :-P), however Eclipse didn't help with that.
Not a regression from 3.3.x
I think this is a bug in javac that when using 15.12.2.8 to infer from expected type it shouldn't use Object, but upper bound (like we do). If it did, then it would be able to compile this code correctly.
Closing as a javac bug. Added GenericTypeTest#test1428
Verified for 3.5M5