diego-gomez-olvera
fun <T> getClass(type: T): Class<out T> { if (type != null) { return getClass(type) } else { error("Unexpected") } } private fun <T: Any> getClass(type: T) = type::class.java
fun <T> getClass(type: T): Class<out T> { if (type != null) { return type::class.java // Compilation error } else { error("Unexpected") } }
Expression in a class literal has a nullable type 'T', use !! to make the type non-nullable
Sam
A modern programming language that makes developers happier.