`new Task;`, that's not really valid Java. Are you...
# announcements
k
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
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
That doesn't rule out an issue with the decompiler. Or does it actually throw null when you run it?
w
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
Can you post the full bytecode somewhere, eg. on pastebin?
w
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
Nope, that should work.
👍 1
Have you opened an issue yet? I'd be interested in seeing the results.
w
@karelpeeters I remember about it, but I don’t really have much spare time right now.