The following code generates a warning Unchecked cast: 'T' to 'U'
in IntelliJ IDEA:
interface A {}
class B<T extends A, U extends A> {
void f() {
final T t = null;
final U u = (U) t;
}
}
This doesn't make sense to me, since T
and U
are defined as the same type. What is the problem?