You cannot assign this because T1<T1<T1<?>>>
is not an instance of T1<T1<?>>
.
Why? Let's analyze this:
T1<T1<T1<?>>>
: an instance of T1
whose type parameter is exactly T1<T1<?>>
T1<T1<?>>
: an instance of T1
whose type parameter is exactly T1<?>
So you cannot assign because type parameter T1<?>
is not exactly the same as type parameter T1<T1<?>>
.
As John Vernee pointed out in his comment, you'd need T1<? extends T1<?>>
for this to work because:
T1<? extends T1<?>>
: an instance of T1
whose type parameter is T1<?>
or its subtype (like T1<T1<?>>
)
EDIT: Why can you assign T1<T1<?>>
(or even T1<T1<T1<?>>
) to T1<?>
? Because:
T1<?>
: an instance of T1
whose type parameter can by anything
To take it even further: T1<T1<T1<T1<?>>>
could be assigned to the following types having fewer T1
s:
T1<? extends T1<? extends T1<?>>
T1<? extends T1<?>
T1<?>
Object
(which corresponds to pure ?
)
I hope it's clear now how this nested generic subclassing works.
PS. Follow a link in this comment, where wildcard nesting is explained in more detail.