NRE from an "uninitialized this" in constructor


Hi there,

I’m relatively new to Kotlin, and its handling of nulls / prevention of NREs looks really cool. But I’m reading the section that describes the four specific scenarios where one can still get NREs, and I’m having trouble visualizing the last one:

“There’s some data inconsistency with regard to initialization (an uninitialized this available in a constructor is used somewhere)”

When would this happen?

class Foo {
    val c: String

    init {
        c = ""

    fun bar() {


Ah, of course! Thank you for the example.