<https://kotlinlang.org/docs/reference/typecasts.h...
# announcements
k
https://kotlinlang.org/docs/reference/typecasts.html#unsafe-cast-operator Note that null cannot be cast to String as this type is not nullable, i.e. if y is null, the code above throws an exception. In order to match Java cast semantics we have to have nullable type at cast right hand side, like
val x: String? = y as String?