Hi, After updating to Kotlin 2.1.0, Moshi throwing...
# squarelibraries
n
Hi, After updating to Kotlin 2.1.0, Moshi throwing exception on reflection related issues for types like LocalDate, LocalTime, LocalDateTime (I think classes under java.time). For every other custom types everything is working fine. And also with Kotlin 2.0.0 Exception in 🧵
j
Did you bump your minSdk?
n
Copy code
kotlin.reflect.jvm.internal.KotlinReflectionInternalError: Could not compute caller for function: public constructor AdminData(createdBy: kotlin.String, createdOn: java.time.LocalDateTime, createdByFirstName: kotlin.String, createdByLastName: kotlin.String, createdByImageUrl: kotlin.String?, updatedBy: kotlin.String, updatedOn: java.time.LocalDateTime, updatedByFirstName: kotlin.String, updatedByLastName: kotlin.String, updatedByImageUrl: kotlin.String?) defined in com.farmersbyte.enterprise.core.api.response.AdminData[DeserializedClassConstructorDescriptor@e5844c6] (member = null)
@jw No, currently set to minSdk = 24
j
Oh reflection? Probably some new metadata that R8 isn't rewriting properly.
If your min is that low the signature should say
j$.time
not
java.time
n
The exception is happening in debug build also. And I think I didn't enabled R8 yet.
j
D8 also does the rewriting.
If you have core library desugaring on, whoever is doing the translation from Java bytecode to Dalvik bytecode has to rewrite signatures containing those types to
j$.time
not
java.time
. That's either D8 or R8.
n
Oh, Okay. After your hint on minSdk, I updated to 26 and it's working fine now. Issue persist on 25 also.
j
And that is because on 26 and newer the types exist in the framework and do not need rewritten. Thus, the metadata will match the actual signature.
n
But I'm afraid I can't update without approval. Could you please suggest where do I need to report this issue.
j
I would report it as a D8/R8 problem.
n
@jw Thank you very much for your valuable time.