Kotlin: Hacking non Null variable Null!!
Jul 29, 2017 · 1 min read

One of Kotlin most prominent feature above Java is it’s null-safety feature. However, there’s a simple way that make it null, and the code still executable.
Don’t believe? Try the below code.
@Test
fun forceNull() {
val nullBody = """{ "nonNull" : null}"""
val nullNonNull = Gson().fromJson(nullBody, MyData::class.java)
System.out.println(nullNonNull)
}…
