interface Foo {
fun foo()
}
enum class Bar : Foo by Companion {
One,
Two,
;
companion object : Foo {
override fun foo() {
println("Bar.foo")
}
}
}
Bar.One.foo()
Copy code
java.lang.NullPointerException: Cannot invoke "Scratch_18$Bar$Companion.foo()" because "this.$$delegate_0" is null
at Scratch_18$Bar.foo(scratch_18.kts)
at Scratch_18.<init>(scratch_18.kts:22)