Community
Participate
Working Groups
public class BaseClass { } public class GenClass<T extends BaseClass> { } public class EclipseCompilerTest <T extends ArrayList<GenClass<Integer>>> extends TreeMap<Integer, GenClass<String>> { } The classes above pass compilation with the Eclipse compiler, although there're illegal GenClass<Integer> and GenClass<String> instantiations. Sun's 1.5.0_04 reports the errors as expected.
Reproduced... strange.
Actually our boundcheck is not strict enough for type arguments at depth > 1. I think this is something which has changed under us, and we should realign.
We encountered this bug with : public class GenericClass<T extends Number> { } public class GenericClassTwo<T> { } public class EclipseCompilerTest<T> extends GenericClassTwo<GenericClass<T>> { } with 1.6 javac: EclispeCompilerTest.java:2: type parameter T is not within its bound public class EclispeCompilerTest<T> extends GenericClassTwo<GenericClass<T>> { No error or warning with Eclipse 3.2.1 or 3.2.2
The following might be a variant of the same issue (javac reports an error on line marked 1): class X<T> { static class XX<U> extends X<U> { class XXX<V extends I<U>> extends XY<V> { // 1 } } class XY<W extends I<T>> { } } interface I<T> { }
Created attachment 130282 [details] Proposed patch and testcase Philippe - let me know if this patch works for you & I'll release it It passes all of our existing tests
Created attachment 130461 [details] Proposed patch and testcase This patch remembers each TypeRef that we delayed the boundsCheck & does it after the hierarchy is attached
Fix and test released for 3.5M7
Forgot to mark as fixed
Kent, The compiler doesn't report any problem on the code given in the comment #4. Should we treat this as a separate test case? What's your opinion on this one? Jay
b55 of javac 7.0 also doesn't report an error on the case in comment #4 I believe we are correct for this case.
Verified for 3.5M7 using I20090428-0100