Shawn
09/23/2018, 10:01 PMValV
09/23/2018, 10:04 PMValV
09/23/2018, 10:05 PMfinal
i.e. read-only?Shawn
09/23/2018, 10:10 PMfinal var
is weird, but yeah, probablyShawn
09/23/2018, 10:10 PMShawn
09/23/2018, 10:11 PMNothing!
being inferred for T
in that instanceShawn
09/23/2018, 10:11 PMValV
09/23/2018, 10:12 PMValV
09/23/2018, 10:15 PMitem
is a delegate: var item by itemProperty
ValV
09/23/2018, 10:16 PMfinal
, right?Shawn
09/23/2018, 10:17 PMShawn
09/23/2018, 10:17 PMfinal
used in most instances in Kotlin doesn’t do a whole lotShawn
09/23/2018, 10:17 PMValV
09/23/2018, 10:20 PMkarelpeeters
09/23/2018, 10:39 PMA member markedis itself open, i.e. it may be overridden in subclasses. If you want to prohibit re-overriding, use `final`:override
Shawn
09/23/2018, 10:40 PMValV
09/23/2018, 10:50 PMkarelpeeters
09/23/2018, 10:51 PMilya.gorbunov
09/23/2018, 11:46 PMItemViewModel<*>
is an out-projected ItemViewModel<T>
type. You cannot use its members where T is in in
-position, such as the setter of item
property.ValV
09/23/2018, 11:47 PMSetter for 'itemProperty' is removed by type projection
? 🙂ValV
09/23/2018, 11:57 PMilya.gorbunov
09/24/2018, 12:00 AMItemViewModel<KnownType>
, otherwise you can cast it as ItemViewModel<Any?>
(or its generic upper bound instead of Any?
) and hope that the actual view model supports the item you're going to set.
These casts are unchecked and inherently unsafe.ValV
09/24/2018, 12:08 AMItemViewModel<T>
instead of ItemViewModel<Any?>
for a function's argumentValV
09/24/2018, 12:11 AMas ItemViewModel<Any>
ValV
09/24/2018, 12:12 AMitem
became assignableValV
09/24/2018, 12:12 AM