Sebastien Leclerc Lavallee
05/06/2020, 3:12 AMinterface ApiMessage<T : ApiMessage<T>> {
fun convertToBytes(): ByteArray
}
data class GetAllMessagesRequest(): ApiMessage<GetAllMessagesRequest> {
}
And later in my code I want to do something like:
fun performRequest(request: ApiMessage)
But the compiler complain about One type argument expected for T
How could I achieve something like this and received a generic instance of my interface? I can’t really easily change my ApiMessage
interface and request message.
Thanks!