Luv Kumar
07/30/2025, 9:36 AMopen class Parent(open val str: String) {}
class Child : Parent("Child") {
override val str: String = "Overridden ${super.str}"
}
open class ChildEx() : Exception("ChildMsg") {
override val message = "Overridden ${super.message}"
}
@Test
fun `test child class`() {
println("ChildEx: ${ChildEx().message}, Child: ${Child().str}")
}
// Prints
// ChildEx: Overridden undefined, Child: Overridden Child
Shouldn't the behaviour for this be same on all targets(works fine on android/ios, in sense doesn't print undefined), is this documented somewhere or would this be considered a bug ?
i tried some of the approaches by using get() or lazy but both of them run into call stack issues suggesting an infinite loop gets run due to calling message's getter instead of super, any workaround for this would be helpful.Edoardo Luppi
07/30/2025, 9:42 AMLuv Kumar
07/30/2025, 9:43 AMEdoardo Luppi
07/30/2025, 9:49 AMEdoardo Luppi
07/30/2025, 9:51 AMLuv Kumar
07/30/2025, 10:02 AMA<-Exception and constructs it's own message and passes on to throwable constructor itself. and B<-A and B's constructor arg's don't have any message at all. So we have to modify A to store message separately as well ig. Thanks for your help.