I\'m trying to create an abstract class with generic parameter which will have subclasses which should call methods without having to specify type parameters
There are a couple of problems at play here. First, in order to retrieve a class object from a generic type parameter, you need to reify it. For this you need to declare
.
Second, you declare the generic type parameter twice. Once in the class declaration abstract class AbstractClass
and once in the method declaration inline fun
. Those T
s are not the same. Theoretically you could just leave out the one from the method signature but this doesn't work because reification only works with inline methods not with classes. For a possible solution to that refer to @hotkey's answer.