Return a concrete class that inherits from a generic class
Hi -
I’m trying to do the following:
inline fun getMapper(klass: Class): RFMFunction =
when (klass) {
MClick::class.java -> MClickMapper
else -> { throw RuntimeException("Unknown event type: $klass") }
}
with:
object MClickMapper : RFMFunction()
but Kotlin doesn’t recognize that MClickMapper is a subclass of RFMFunction.
I tried as RFMFunction in the when, but that didn’t work.
Is there a way to do that?
Thanks!
1 post - 1 participant
<a...