william
03/07/2021, 8:58 PMinit
block and then top level value assignments causing an exception. heres a min example:
class Foo(bar: Bar) {
init {
CoroutineScope(Dispatchers.Default).launch {
bar.buzz()
}
}
val a = 3
}
in the init block since bar is accessed, it seems like that is causing the entire foo object to also get frozen
then when it gets to val a = 3
during runtime - it complains about foo instance already being frozen. how can i go about fixing this?william
03/07/2021, 9:23 PMTijl
03/08/2021, 7:28 AMclass Foo(bar: Bar) {
init {
val bar = bar
CoroutineScope(Dispatchers.Default).launch {
bar.buzz()
}
}
val a = 3
}
Tijl
03/08/2021, 7:29 AM