Community
Participate
Working Groups
Build ID: I20080108-1320 Steps To Reproduce: Under situations where a generic type is specified in terms of its generic parameter extending multiple interfaces, the compiler will emit errors which do not help the user understand what they are doing wrong. It would be useful to explain to the user that multiple bounds cannot be used within a generic type definition. Sample code of success and failures provided below More information: public interface Testable { <T extends Comparable<?> & Iterable<?>> void w1(T foo); // Works <T extends Comparable<?> & Iterable<?>> void w2(Class<T> foo); // Works <T extends Comparable<?> & Iterable<?>> Class<T> w3(); // Works Class<? extends Comparable<?> & Iterable<?> > f1(); // Fails void f2(Class<? extends Comparable<?> & Iterable<?>> foo); // Fails }
This would mean making the grammar more permissive and report the issue later on....
Note that javac doesn't do any better than we do.