Michael Böiers
04/07/2021, 4:03 PMimport java.util.*
fun compiles() {
val map: AbstractMap<String, String> = TreeMap()
map["key"] = null // non-null not enforced (platform type)
}
fun `does not compile` () {
val map = TreeMap<String, String>()
map["key"] = null // non-null enforced? Why? Isn't this also a platform type?
}
Michael Böiers
04/07/2021, 4:07 PMimport java.util.*
fun compiles() {
val map = TreeMap<String, String>() as AbstractMap<String, String>
map["key"] = null // non-null not enforced (platform type)
}
fun `doesn't compile` () {
val map = TreeMap<String, String>()
map["key"] = null // non-null enforced in TreeMap, but not AbstractMap?
}
nanodeath
04/07/2021, 4:15 PMput
for the two calls?Michael Böiers
04/07/2021, 4:18 PMset
calls.nanodeath
04/07/2021, 4:20 PMMichael Böiers
04/07/2021, 4:20 PMMichael Böiers
04/07/2021, 4:21 PMMap
uses put
in Java, but Set
uses set
.Roukanken
04/07/2021, 4:34 PMnanodeath
04/07/2021, 4:38 PMnanodeath
04/07/2021, 4:39 PMnanodeath
04/07/2021, 4:40 PMnanodeath
04/07/2021, 4:41 PMAlexey Belkov [JB]
04/08/2021, 8:26 AMMichael Böiers
04/08/2021, 8:58 AMthana
04/08/2021, 9:06 AM