Support Kotlin 1.9.0+
colintheshots-meetup opened this issue · 5 comments
I noticed that code has been landed to support Kotlin 1.9.0 by @ZacSweers but no release has been made to include it. I've been checking this repository's CHANGELOG daily for a new release. It's starting to become a problem, since we need to upgrade Kotlin for other dependencies.
Could we please release with the Kotlin 1.9 fixes in place?
Is this likely to be supported soon? We have the same issue, needing to update Kotlin for other dependencies.
Moshi 1.15.0 (released in May 2023) supports kotlin 1.9.0 and is documented as such in the changelog. What am I missing?
https://github.com/square/moshi/blob/master/CHANGELOG.md#version-1150
https://repo1.maven.org/maven2/com/squareup/moshi/moshi-kotlin-codegen/1.15.0/
As far as I could tell, the Kotlin 1.9.x changes you wrote never made it to a release. Moshi 1.15.0 predates those fixes. And the CHANGELOG shows Kotlin 1.8.21 support plus KAPT support for 1.9.0. We ended up converting all of our remaining Moshi code to KotlinX-serialization, since I was unable to upgrade Kotlin when using Moshi 1.15.0.
I should've noted and pasted the actual error preventing the upgrade at the time.
My theory is that the problem was Moshi-sealed. We'd been on an older version. 0.2.0. But I was looking at the base Moshi library for the fix as the error didn't make the issue clear.
Normally dependabot would keep us up to date, but only the old legacy code was using Moshi. We mostly use GraphQL now instead of REST. The largely untouched legacy code using Moshi and Moshi-sealed hadn't been updated to reference the newest MoshiX repo, so it wasn't getting updates.
I believe the issue here is that we Moshi-sealed was causing the errors. There's newer version of Moshi-sealed in the MoshiX repo to support new Kotlin versions. I'll close this ticket for now. Please feel free to re-open it with an error message if this doesn't fix your issue.
To add clarity
Moshi kapt code gen 1.15.0 supports kotlin 1.9.0. It's not built against Kotlin 1.9.0. That's ok, what matters is what version the kotlinx-metadata-jvm library under the hood supports, which includes support for 1.9.0 in the version that Moshi 1.15.0 is built against. It is not built from the master
branch because the master branch is a preparation for an eventual Moshi 2.0, so we cut 1.x releases from other branches to minimize changes.
For everything else – Kotlin 1.9.0 is fully supported. Starting with Moshi 1.15.0, kapt support is actually straight up deprecated and won't support Kotlin 2.0 anymore. Please use KSP or (if you're ok with a compiler plugin) moshi-ir. Importantly, update your dependencies periodically :).