Reputation: 101
when I declare a property in a class as following:
class xx{
var b:()->Boolean={false}
}
and then decompiled as following:
......
public xxx() {
this.b = (Function0)null.INSTANCE;
}
......
what does the (Function0)null.INSTANCE stand for? I think it will be :
this.b= new Function0() {
public final Object invoke() {
return false;
}
};
but it doesn't ,why?
Thanks!
Upvotes: 5
Views: 1047
Reputation: 12167
Decompiler not showing the correct result: e.g. when doing it with JD-GUI, you get:
final class xx$b$1 extends Lambda implements kotlin.jvm.functions.Function0<Boolean> {
public final boolean invoke() { return false; }
public static final 1 INSTANCE = new 1();
xx$b$1()
{
super(0);
}
}
public final class xx {
// ... getter and setter
private Function0<Boolean> b = (Function0)xx.b.1.INSTANCE;
}
Upvotes: 6