-
Notifications
You must be signed in to change notification settings - Fork 761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Kotlin inline/value classes #1170
Comments
inline classes are not supported as they're not stable in kotlin itself yet |
Sure, and I'm not suggesting this requires an immediate fix—I have a work-around I can use for now for my own use cases. But as inline classes are an extremely useful feature, and ostensibly the goal is to support them as they become stable in Kotlin, it is worth tracking and understanding how, as inline classes evolve and become stable, this would/could be addressed. No? |
Yep, when Kotlin has inline classes we’ll find a way to make ’em work nicely with Moshi. |
Heads up, Kotlin 1.5 is stabilizing inline classes, and the stable functionality is available in 1.4.30 via a build.gradle switch. |
Kotlin 1.5 is out! https://blog.jetbrains.com/kotlin/2021/05/kotlin-1-5-0-released/ |
We should probably try to match how kotlinx-serialization treats them: https://youtrack.jetbrains.com/issue/KT-28791 PRs are welcome once #1339 merges and we update KotlinPoet. We will want to support this in both reflection and code gen, doesn't have to be the same PR but ideally we can reuse tests. |
kotlin-reflect itself doesn't support these either, so I think it will be awhile. https://youtrack.jetbrains.com/issue/KT-27598 |
Sharing regarding an update to a related issue. https://youtrack.jetbrains.com/issue/KT-27598 |
Any updates on supporting Kotlin UINT ? Or any workarounds known? |
Value classes aren't supported by moshi yet, which is a blocker for my other projects. square/moshi#1170
Hey, @ZacSweers, do you have any plans or updates here? |
Suppose I have the following:
This compiles and works fine. But if I give any property a default value, e.g.
I get the following traceback when trying to deserialize, e.g.
{"id": 10, "distance": 20000}
:I suspect this is an interaction with inline classes: if I change to
val distance: Int
, all is good.LMK if there is anything I can do to help diagnose or clarify!
The text was updated successfully, but these errors were encountered: