I've done this code and don't uderstand what could be wrong :
fun <T : ComplicationDataSourceService> getCorrespondingComplicationService(): Class<T>? {
return when (this) {
IMMOBILITY -> ImmobilityComplicationService::class.java
HEART_RATE -> null
POWER_BUTTON -> null
SHORTCUT -> null
}
}
class ImmobilityComplicationService: ComplicationDataSourceService() {
...
}
I got this compilation error : Type mismatch, required: Class<T>? Found: Class<ImmobilityComplicationService>
Thanks