hi. i was playing around in code decompiling when ...
# getting-started
g
hi. i was playing around in code decompiling when I came across this. this is the kotlin code:
Copy code
fun main() {
    val number = 300
    val serial = 40400
}
when i decompile it to look at the java code, it shows something like this:
Copy code
public final class MainKt {
   public static final void main() {
      int number = true;
      int serial = 404000;
   }
why first variable is
true
but the second one has its original value? additionally, when i make
val serial = 40400
, i get this in the java side:
Copy code
public final class MainKt {
   public static final void main() {
      int number = true;
      int serial = '鷐';
   }
can someone explain how actually this decompiling work? what's that character there?
y
This might be a decompilation artifact. What decompiler are you using? The IntelliJ one does very strange things sometimes. I'd recommend CFR
g
oh, got it. yeah i was using intellij idea. thanks for the answer. appreciated 🙌🏻
y
FWIW, CFR gives me the expected result:
Copy code
/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  kotlin.Metadata
 */
import kotlin.Metadata;

@Metadata(mv={2, 0, 0}, k=2, xi=48, d1={"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u001a\u0006\u0010\u0000\u001a\u00020\u0001\u00a8\u0006\u0002"}, d2={"main", "", "library_test"})
public final class FooKt {
    public static final void main() {
        int number = 300;
        int serial = 40400;
    }

    public static /* synthetic */ void main(String[] args) {
        FooKt.main();
    }
}
🙌 1
p
Just a small remark: it seems the decompiler transformed 40400 into a Unicode codepoint, as 鷐 == U+9DD0 (0x9DD0 == 40400).
🤯 1
g
thanks @Youssef Shoaib [MOD] @Paulo Cereda. appreciated!