Why is this causing compilation error:
public <S super T> void addImplements(Class<S> cl)
whereas this is OK:
public <S extends T> void addImplementedBy(Class<S> cl)
T
is a type parameter specified on the class.
Error message on the first is Syntax error on token "super", , expected
update
This is apparently OK:
public void addImplements(Class<? super T> cl)
Which is essentially the same but without the named type S
.
Why is the first variant not allowed or supported? It would appear that technically it is perfectly possible to support it. So is it invalid by design or just not supported (yet)?
I'm not getting the "doesn't buy you anything" from the linked duplicate answer. For one it buys me a named type S
that I can use. The second variant (? super T
) doesn't offer that.
Note same in Java7 and Java8