Let's consider the following example:
List<Integer> test = new ArrayList<Integer>();
Class<? extends List> clazz = test.getClass();
the static type of test
(the expression on which getClass() is called
) is List<Integer>
of which the erasure is List
(see type erasure). Note that the dynamic (or runtime) type of test
is ArrayList
, and the runtime type of clazz
will be Class<ArrayList>
.
So, Class<? extends |X|>
in this case is Class<? extends List>
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…