Community
Participate
Working Groups
The following code creates an error in eclipse RC3, but compiles using Sun JDK1.5: 1: interface BaseClass<T> { 2: <U extends T> U getItem(); 3: } 4: class SubClass implements BaseClass<Boolean> { 5: public <U extends Boolean> U getItem() {...} 6: } Line 5 gives a warning: "The type parameter U should not be bounded by the final type Boolean" As a consequence Eclipse does not think SubClass is implementing BaseClass. Not that if using "Add unimplemented methods" to create the stub in SubClass, this (line #5) is the signature eclipse creates.
The previous example shows the problem, but might be considered stupid, so here's another example that don't compile showing that it really is a serious bug: interface Factory<T> { <U extends T> U create(Class<U> c); } class BooleanFactory implements Factory<Boolean> { <U extends Boolean> U create(Class<U> c) { try { return c.newInstance(); } catch(Exception e) { return null; } } }
Too late for considering it for 3.1. Will consider it for 3.1.1 as it has no obvious workaround.
Added MethodVerify test070
Verified for 3.1.1 using M20050923-1430.