When extending a typed class without specifying the type, just pass the type to the subclass’s erasure and specify that type in the reference to the superclass.


As an example, consider the AOSP class RecyclerView.Adapter, which is declared as:

A normal concrete implementation is fairly straightforward:

But what if you want to create an abstract subclass and also expect the concrete implementation to specify its type? The answer is to type the class normally, and pass the reference to the superclass’s type param: