The following statements:
URLClassLoader ucl = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class<URLClassLoader> uclc = ucl.getClass();
fail with error:
Type mismatch: cannot convert from Class<capture#2-of ? extends URLClassLoader> to Class<URLClassLoader>
Why do I need a cast, here?
I found several posts explaining why You can't do the reverse (assign T to a ), but that's (kind of) obvious and understood.
NOTE: I am coding this under eclipse Luna, so I don't know if it's a Luna Quirk or if there's something I really dont understand in generics.
Class<? extends T>
(orClass<?>
) is not a subtype ofClass<T>
? I think it is. – Kinnon