kevinmost
09/12/2019, 7:15 PMreified from the function header and run againkevinmost
09/12/2019, 7:21 PMval f: String = functionThatReturnsNull() would fail at runtime. If that function were a Java function returning String!, there'd be a KotlinNullPointerException here.kevinmost
09/12/2019, 7:25 PMCasey Brooks
09/12/2019, 7:25 PM<T : Any>. Just T is interpreted as “any type, including a null type”. And since nullability is not a property of the JVM, it does not fail at runtime unless the compiler knows it’s not a nullable generic typekevinmost
09/16/2019, 1:08 PMfoo<String> (so T is String, which is a non-nullable type, of course), when you do result as T in the method, since the Kotlin compiler knows that T is non-nullable, it should generate an intrinsic non-null check for result right before the cast.