# Lambda initial and decompiler to java

**URL:** <https://discuss.kotlinlang.org/t/lambda-initial-and-decompiler-to-java/3582>\
**Category:** Uncategorized\
**Created:** [July 2, 2017, 8:47am UTC](https://discuss.kotlinlang.org/t/lambda-initial-and-decompiler-to-java/3582 "2017-07-02T08:47:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![xzw520xn](https://avatars.discourse-cdn.com/v4/letter/x/71c47a/32.png) [@xzw520xn](https://discuss.kotlinlang.org/u/xzw520xn)\
**Post date:** [July 2, 2017, 8:47am UTC](https://discuss.kotlinlang.org/t/lambda-initial-and-decompiler-to-java/3582/1 "2017-07-02T08:47:22Z")

</div>

when i declare a propperty in a class like following:  
class xx{  
var a:()-\>Boolean={false}  
}

and then decompiler as following:  
…

public xxx() {  
this.b = (Function0)null.INSTANCE;  
}

…  
what does the (Function0)null.INSTANCE stands for?  
i think it will be :this.b= new Function0() {  
public final Object invoke() {  
return false;  
}  
};  
but not ,why?

---

<div class="post-metadata">

**Author:** ![yole](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/yole/32/1425_2.png) [@yole](https://discuss.kotlinlang.org/u/yole)\
**Post date:** [July 3, 2017, 9:21am UTC](https://discuss.kotlinlang.org/t/lambda-initial-and-decompiler-to-java/3582/2 "2017-07-03T09:21:31Z")

</div>

The Java decompiler is intended to decompile code produced by the Java compiler. In most cases, it can produce sensible results when decompiling Kotlin-generated bytecode, but that is not always the case. In this particular case, the decompiled code is incorrect and does not represent what is actually happening.

---

<div class="post-metadata">

**Author:** ![xzw520xn](https://avatars.discourse-cdn.com/v4/letter/x/71c47a/32.png) [@xzw520xn](https://discuss.kotlinlang.org/u/xzw520xn)\
**Post date:** [July 3, 2017, 11:22am UTC](https://discuss.kotlinlang.org/t/lambda-initial-and-decompiler-to-java/3582/3 "2017-07-03T11:22:44Z")

</div>

think’s for your wonderful reply!  
and can you tell me how to decompile the code correctly?

---

<div class="post-metadata">

**Author:** ![yole](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/yole/32/1425_2.png) [@yole](https://discuss.kotlinlang.org/u/yole)\
**Post date:** [July 3, 2017, 11:27am UTC](https://discuss.kotlinlang.org/t/lambda-initial-and-decompiler-to-java/3582/4 "2017-07-03T11:27:56Z")

</div>

I’m not aware of any decompiler that handles Kotlin-generated code better.

---

<div class="post-metadata">

**Author:** ![xzw520xn](https://avatars.discourse-cdn.com/v4/letter/x/71c47a/32.png) [@xzw520xn](https://discuss.kotlinlang.org/u/xzw520xn)\
**Post date:** [July 3, 2017, 11:38am UTC](https://discuss.kotlinlang.org/t/lambda-initial-and-decompiler-to-java/3582/5 "2017-07-03T11:38:59Z")

</div>

thanks for your reply!

---

<div class="post-metadata">

**Author:** ![pdvrieze](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/pdvrieze/32/1882_2.png) [@pdvrieze](https://discuss.kotlinlang.org/u/pdvrieze)\
**Post date:** [July 4, 2017, 1:35am UTC](https://discuss.kotlinlang.org/t/lambda-initial-and-decompiler-to-java/3582/6 "2017-07-04T01:35:36Z")

</div>

If you just want to know what is going on, the disassembler will be able to tell you (but less accessible than a decompiler). The Kotlin plugin will even display the generated bytecode for you.
