Is there a way to debug whether an inline class in...
# intellij
d
Is there a way to debug whether an inline class instance is boxed or unboxed at any given point?
u
My understanding is that there is no boxing/unboxing. Everything is done at compilation time and there is no trace of the inline class in the bytecode. Please correct me if I'm wrong.
d
There is: https://kotlinlang.org/docs/reference/inline-classes.html#representation
As a rule of thumb, inline classes are boxed whenever they are used as another type.
so e.g. if you pass an inline class instance to a function that accepts an
Any
parameter, you’re going to get the boxed version
👍 1
k
You can always look at the generated bytecode and decompiled Java,
Tools > Kotlin > Show Kotlin Bytecode > Decompile
👍 1