kevinmost
09/12/2019, 7:15 PMreified from the function header and run againRuckus
09/12/2019, 7:19 PMreified, it fails as expected. Without reified, it show warnings for unchecked casts.kevinmost
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.Ruckus
09/12/2019, 7:22 PMkevinmost
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 typeRuckus
09/12/2019, 7:29 PMkevinmost
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.