Hi guys, got a question about `PreconditionsKt.che...
# announcements
a
Hi guys, got a question about `PreconditionsKt.checkNotNull()`: Is that ok that after
checkNotNull()
compiler still thinks that the
value
can be null?
Copy code
class TargetClass(private val value: String? = null) {
    fun functionThatUsesValue() {
        checkNotNull(value)

        // Still need to add ?. to the value call
        println("split: ${value?.split(" ")}")
    }
}

fun main(args: Array<String>) {
    val target = TargetClass()
    target.functionThatUsesValue()
}
k
Hey, you could in fact do this:
Copy code
val nonNull = checkNotNull(value)
// use `nonNull` here freely