Why Kotlin decompiler produces trash local variables

I mean in Android Studio, when you try to look in Kotlin bytecode, and than press “Decompile”.
For example Kotlin function:
image
And the decompiled java:

What the reason in creating local variables:
boolean var7 = false;
boolean var8 = false;
int var10 = false;

1 Like

I also wondered about it. When you take a look at the bytecode you can also notice that there are some unused values assigned.

These booleans are used by debugger to determine whether we are inside inline function/lambda or not.

6 Likes

Thanks, it is clear now. And as I understand it is wiped out during release compilation.

There is no such thing as release compilation, only if you use some tool to optimize your bytecode, such as Proguard

2 Likes