I think this happens if the class you cast to is a...
# announcements
m
I think this happens if the class you cast to is an array with non-null elements, because the compiler can't guarantee the nullability of its elements. This will compile with an unchecked warning and will fail with a NPE at runtime:
Copy code
val array = arrayOf(1,2, null)
(array as? Array<Int>)?.forEach(::println)