I came by this construction when reading a codebase and I can't figure out what it does/represents:
public interface MyInterface<T extends MyInterface<T>> {}
I don't understand what the type bound does here - it seems almost recursive? What's really the restriction on T in this case?
It means that any class that implements the interface must specify
Tas themselves:Here
TisMyClass, which extendsMyInterface<MyClass>, so theT extends MyInterface<T>bound is satisfied.