https://kotlinlang.org logo
#announcements
Title
# announcements
k

karelpeeters

07/10/2017, 3:17 PM
new Task;
, that's not really valid Java. Are you sure there's not some issue with the decompiler? Kotlin does sometimes generate bytecode that doesn't have a valid Java counterpart.
w

wasyl

07/10/2017, 3:18 PM
karelpeeters: The code throws
null
, so something’s definitely wrong. When I extract the when, it works fine
The bytecode is still weird:
Copy code
L0
    ALOAD 1
    LDC "parcel"
    INVOKESTATIC kotlin/jvm/internal/Intrinsics.checkParameterIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
   L1
    LINENUMBER 47 L1
    NEW com/homer/courierapp/domain/entity/Task
    DUP
   L2
    LINENUMBER 48 L2
    ALOAD 1
    INVOKEVIRTUAL android/os/Parcel.readLong ()J
k

karelpeeters

07/10/2017, 3:19 PM
That doesn't rule out an issue with the decompiler. Or does it actually throw null when you run it?
w

wasyl

07/10/2017, 3:20 PM
It does throw
null
when I run it
I now doesn’t know whether that bytecode is weird. Either way the exception is thrown while it shouldn’t. Also the IDE complains at the constructor site, that code is unreachabkle
k

karelpeeters

07/10/2017, 3:21 PM
Can you post the full bytecode somewhere, eg. on pastebin?
w

wasyl

07/10/2017, 3:41 PM
I just want to know if there’s something that I’m missing if the code with inline
when
doesn’t work, but when extracted it does. If not, I’ll create a proper issue for that
k

karelpeeters

07/10/2017, 3:42 PM
Nope, that should work.
👍 1
Have you opened an issue yet? I'd be interested in seeing the results.
w

wasyl

07/11/2017, 9:28 AM
@karelpeeters I remember about it, but I don’t really have much spare time right now.
3 Views