I have the below
open class Model
class WorkOrder : Model()
//An interface
interface ViewInterface<T : Model> {
fun notifyDataSuccessful(model: T?, models:ArrayList<T>?)
}
class WorkOrderSystemImpl(val viewInterface: ViewInterface<Model>) {
fun doSomething() {
val workOrders: ArrayList<WorkOrder> = ArrayList()
//the below line complains of type mismatch
viewInterface.notifyDataSuccessful(workOrders)
}
}
It complains of type-mismatch which is quite strange to me, because WorkOrder is a sub-type of Model and i'd expect it to resolve to same type.