I use the .class-operator to supply information about the contained type to a generic class. For non-generic contained types, e.g. Integer.class,
Class> tListInt3 =
(Class>) ((Class)List.class);
that doesn't work. you probably meant
Class> tListInt3 =
(Class>) ((Class)List.class);
we can always cast from one type to another by up-cast then down-cast
Integer x = (Integer)(Object)"string";
The type of List.class is Class; it is not a subtype/supertype of Class therefore direct cast between the two types is illegal.>
It can be argued that Class doesn't exist - there is only a class for >
List; there is no such class for List (which really is just List at runtime)
However, this is a flaw of Java type system; in practice we do need things like Class. Our solution - casting and pretending >
Class exits - is likewise flawed - but it's not our fault.>