I have this code: ``` override fun fromParcel(parc...
# announcements
w
I have this code:
Copy code
override fun fromParcel(parcel: Parcel): Task = Task(
        parcel.readLong(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readInt().toBoolean(),
        when (parcel.readInt()) {
            TASK_TYPE_LOCATION -> Parcels.unwrap(parcel.readParcelable(this.javaClass.classLoader))
            else -> throw IllegalStateException("Unknown TaskType")
        }
)
which generates wildly unexpected bytecode, here’s decompiled to Java:
Copy code
@NotNull
   public Task fromParcel(@NotNull Parcel parcel) {
      Intrinsics.checkParameterIsNotNull(parcel, "parcel");
      new Task;
      parcel.readLong();
      Intrinsics.checkExpressionValueIsNotNull(parcel.readString(), "parcel.readString()");
      Intrinsics.checkExpressionValueIsNotNull(parcel.readString(), "parcel.readString()");
      Intrinsics.checkExpressionValueIsNotNull(parcel.readString(), "parcel.readString()");
      ParcelRegistryKt.toBoolean(parcel.readInt());
      switch(parcel.readInt()) {
      case 0:
         Parcels.unwrap(parcel.readParcelable(this.getClass().getClassLoader()));
         throw null;
      default:
         throw (Throwable)(new IllegalStateException("Unknown TaskType"));
      }
   }
Should I file an issue? It seems to be something more complicated (I wasn’t able to make a small repro yet),
Parcels.unwrap
has a generic type, so it might be something connected with that. Although I’d like to make sure I’m not missing something obvious about throwing from
when
blocks etc. A sidenote - if I extract the
when
to a function, everything works fine