tipsy
04/12/2021, 9:09 PMjava.lang.Object
in a map with type Map<Class<*>, Any>
, i'm getting the following error message that i'm not able to figure out:
Required type: capture of ? extends Object
Provided: Object
diesieben07
04/12/2021, 9:10 PMMap
in Kotlin is Map<K, out V>
because Map
is read only. If you intend to mutate it you should declare it as MutableMap
tipsy
04/12/2021, 9:15 PMtipsy
04/12/2021, 9:15 PMtipsy
04/12/2021, 9:15 PMtipsy
04/12/2021, 9:15 PMtipsy
04/12/2021, 9:16 PMdiesieben07
04/12/2021, 9:18 PMMap<Class<*>, Any>
= Map<Class<*>, out Any>
= Map<Class<?>, ? extends Object>
diesieben07
04/12/2021, 9:19 PMObject
. That effectively means "I can't put anything in here, because I don't know what goes there"diesieben07
04/12/2021, 9:19 PM