Community
Participate
Working Groups
Eclipse allows the following illegal cast: interface C extends B<String>{} interface D extends B<Integer>{} interface A<T> {} interface B<T> {} class Z { public static void main(String[] args) { D d = null; C c = (C)d; // illegal } }
Reproduced with latest.
Added GenericTypeTest#test732-736. Cast check between interfaces must ensure no incompatible supertype exist. Check similar to connecting superinterfaces for a type (except for hierarchy it is a bit as no wildcard can be used). Defined and used ReferenceBinding#hasIncompatibleSuperType(...) Fixed
Fixed
Added more tests to cover mixed class/interface scenarii: GenericTypeTest#test738-741
Verified for 3.1 RC2 using build I20050610-0010 + JDT/Core head
Verified in I20050610-1200.