Here\'s my issue: given these classes
class A {}
class B extends A {}
This code compiles:
List
In the first example, the inferred type of the Arrays.asList()
call is List
, which is obviously assignable to a variable of the same type.
In the second example, the type of the right side is List
. While Class
is assignable to Class extends A>
, List
is not assignable to List
. It would be assignable to List extends Class extends A>>
.
The reason for this is the same one as why a List
isn't assignable to List
. If it was, it would make the following (not-typesafe) code possible:
List> bb = new ArrayList();
List> aa = bb;
aa.add(A.class);