nickheitz
11/05/2020, 11:47 AMval deviceMap = mutableMapOf(
"organisationId" to authenticationData.organisationId,
"userId" to authenticationData.userId,
"deviceTemplateUuid" to AuthenticationService.DeviceTemplate.findById(authenticationData.deviceTemplateId).clientId,
"dateInstalled" to dateInstalled
).also {
it.putAll(extraProps)
}
The variable "extraProp" is defined as Map<String, Any>.
In the past, I'm certain kotlin would have interpreted the return from "mutableMapOf" as MutableMap<String, Any>, but now I'm suddenly getting the following compiler error:
Kotlin: Type mismatch: inferred type is Map<String, Any> but Map<out String, {Comparable<{Instant & String & UUID}> & java.io.Serializable}> was expected
Is it mandatory now that I give a type hint to the function as "mutableMapOf<String,Any>(...)" to avoid this Union type nightmare?Kroppeb
11/05/2020, 1:24 PM