Generics: T extends MyClass vs. T extends MyClass<T>

Viewed 2510

Is there a semantic difference between these two declaration or is it only syntactic sugar?

class C<T extends C> vs class C<T extends C<T>>

Background: I recently answered a question on generics using the C<T extends C> approach and a peer provided a similar answer based on C<T extends C<T>>. At the end, both alternatives provided the same result (in the context of the question asked). I remained curious about the difference between these two constructs.

Is there's a semantic difference? If so, what are the implications and consequences of each approach?

3 Answers
Related