https://kotlinlang.org logo
#announcements
Title
# announcements
i

ilya.gorbunov

06/09/2017, 1:01 AM
@groostav Take a look at this example: https://try.kotlinlang.org/#/UserProjects/q1qp3un899nd41tcall8qmapg5/9kedig2qt02lre65kj8jt9eqan What is different from your code?
🤔 1
g

groostav

06/09/2017, 3:27 AM
ilya.gorbunov: Oh, of course, the obvious bit. try
Copy code
override fun fillInStackTrace(): Throwable{
  println(trace.lines())
}
i

ilya.gorbunov

06/09/2017, 3:28 AM
So why can't you move that code from
fillInStackTrace
to
init
?
g

groostav

06/09/2017, 3:28 AM
because I'm trying to modify the stack trace...
and I had it in my head that you can only do that from
fillInStackTrace
but thats not right, thats just a performance optimization
if I do it from init it'l cause the JVM to build the stack trace once, then over-write that result, which means I burn a little CPU time, but no other problems
or no, thats not right either, I can simply override
fillInStackTrace
to no-op, then
setStackTrace
in the init call
sorry I'm really confused with this API, thanks Ilya.
i

ilya.gorbunov

06/09/2017, 3:31 AM
np