Open LouisCAD opened 7 years ago
From what I remember, no, but that was back when it was first introduced. We should look again.
On Mon, May 15, 2017 at 12:47 PM Louis CAD notifications@github.com wrote:
Here's a lightweight version of kotlin-reflect: https://github.com/Kotlin/kotlinx.reflect.lite My question is: Can it be used for Moshi to bring the library size down? If yes, this issue is a feature request for it.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/square/moshi/issues/307, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEagcpXw6-O0zwYhNGINdyS74AyS1ks5r6KvUgaJpZM4NbmkG .
Currently the only supported features are names of parameters and nullability of their types.
kotlinx.reflect.lite
, such as getting the primary constructor and declared member properties.Maybe you should reach to JetBrains so they include reflection features Moshi needs into kotlinx.reflect.lite
?
Other options:
Does moshi has any plan to support annotation processing instead of reflection?
No plans. Try auto-value-moshi.
On Mon, Jun 12, 2017 at 3:00 AM twocity notifications@github.com wrote:
Does moshi has any plan to support annotation processing instead of reflection?
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/square/moshi/issues/307#issuecomment-307706132, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEf57aHJjJgDVFYT5xYhflFA78frNks5sDOIfgaJpZM4NbmkG .
I opened an issue in Youtrack about the gigantic size of kotlin-reflect, not ideal for Instant Apps. I requested a split, and to use Protobuf Nano (if not done already): https://youtrack.jetbrains.com/issue/KT-20793
It seems Room from Android Architecture Components can use Kotlin data classes without using the 1MB large (after proguarding!!) kotlin-reflect thanks to kapt generated code. Couldn't a similar technique be used in moshi? This 1MB overhead makes it hard to build an efficient Instant App with moshi
I have not used it, but https://github.com/ansman/kotshi exists. As Jake said, no current plans to support an annotation processor in this project.
I think if the features listed here were implemented, use of kotlinx.reflect.lite
would be possible in Moshi.
Just an update on this for posterity: We now have a code generation artifact, and kotlinx.reflect.lite hasn't been updated in two years, though there is a PR open on it to move to kotlinx-metadata and improve the API: https://github.com/Kotlin/kotlinx.reflect.lite/pull/12. We can revisit this if that PR is ever merged
I've opened a PR that resolves this in spirit via replacing kotlin-reflect with kotlinx-metadata instead https://github.com/square/moshi/pull/1076
Here's a lightweight version of kotlin-reflect: https://github.com/Kotlin/kotlinx.reflect.lite My question is: Can it be used for Moshi to bring the library size down? If yes, this issue is a feature request for it.