mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 07:11:52 +01:00
Do not suppress a type system error (#2524)
This code was sort of fine when it used raw Java types, but the Kotlin equivalent technically calls a method that takes a Nothing-typed argument with a value that is not of type Nothing. Whether that works depends on how lenient kotlinc is about inserting casts in bytecode. The solution is to give the unknown type represented by a star an explicit name by capturing it in a type variable, then cast to that type instead of Nothing. This is guaranteed to be an unchecked, but valid, cast.
This commit is contained in:
parent
ee8a53188c
commit
c22e2e8159
@ -29,7 +29,9 @@ class NucleusConductorDelegate<P : Presenter<*>>(private val factory: PresenterF
|
|||||||
bundle = presenterState
|
bundle = presenterState
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("TYPE_MISMATCH")
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
private fun <View> Presenter<View>.takeView(view: Any) = takeView(view as View)
|
||||||
|
|
||||||
fun onTakeView(view: Any) {
|
fun onTakeView(view: Any) {
|
||||||
presenter?.takeView(view)
|
presenter?.takeView(view)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user