sebastiano
05/30/2017, 8:01 AMapply() when I saw something interesting.
https://gist.github.com/dextorer/685e03625daba34b17628da38a86d7e7
As you can see on the Kotlin snippet, in L0-L1-L2 there’s what I think is an unnecessary couple of `aload/astore`: after having created the object and having called the constructor, the object is essentially copied to position 2 of the local variables array only to be then loaded again.
After toying around a bit, it seems like this extra operation is caused by the apply lambda: removing it produces the bytecode that I would expect (and that is identical to the Java equivalent, also included in that gist file).
I am curious to understand why this is happening, anyone can shine some light on this? 🙂