I have this simple kotlin class:
class MyClass {
private val x: Int = 10
val m: (Int) -> Int = { a: Int ->
a*a + a
}
}
and I used the IntelliJ decompiler and this is the java code:
public final class MyClass {
private final int x = 10;
@NotNull
private final Function1 m;
@NotNull
public final Function1 getM() {
return this.m;
}
public MyClass() {
this.m = (Function1)null.INSTANCE;
}
}
as you can see there is no sign of what's placed in the lambda argument m which is a*a + a in the java code and it always returns a null value for m. however, there exists a bytecode for that code:
public final invoke(I)I
// annotable parameter count: 1 (visible)
// annotable parameter count: 1 (invisible)
L0
LINENUMBER 7 L0
ILOAD 1
ILOAD 1
IMUL
ILOAD 1
IADD
L1
IRETURN
L2
I guess this is a problem with decompiler right? if so what decompiler should I use?