Allen Eubank
02/04/2021, 5:28 PMCannot use 'T' as reified type parameter. Use a class instead.
. Is there a way to keep `sendMessage/receiveMessage`` in the abstract class? Or do I have to move it into the concrete implementation?Ivan Pavlov
02/04/2021, 8:37 PMJson.decodeFromString
function is a reified one but you can't pass erased T there. Probably there is overload for this function which accepts KClass parameter. So the solution here is to store reference to a KClass instance in constructor (private val clazz: KClass<T>
) and pass concrete classes in inheritors. After that you can pass it to Json.decodeFromString
if there is such overloadAllen Eubank
02/04/2021, 9:43 PM