class A {
init {
// println(str) // compile time error: variable `str` must be initialized
logContent() // no compile error, but `str` is `null` at this moment
}
val str = ""
private fun logContent() {
println(str)
}
}
fun main() {
A() // print: null
}
I know that this is logically wrong.
But, no compile time error, is this a bug of Kotlin ?