Working on Kotlin 1.3.61
Having this code:
abstract class ResourceObserver<T> : Observer<T> where T : Resource<T> {
override fun onChanged(t: T) {
when (t.status) {
Status.LOADING -> { ... }
Status.ERROR -> { ... }
Status.SUCCESS -> { onSuccess(t.data) }
}
}
abstract fun onSuccess(data: T?)
}
and trying to implement it
private val foo = object : ResourceObserver<Resource<Bar>> {
override fun onSuccess(data: Bar?) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
Compiler (Android Studio in this case) gives me this error:
Type argument is not within its bounds.
Expected: Resource<Resource<Bar>>
Found: Resource<Bar>
What is wrong with my obviously erroneous code?
Type argument is not within its bounds. Expected: Resource<Bar> Found: Bar