arkivanov / Essenty

The most essential libraries for Kotlin Multiplatform development
Apache License 2.0
482 stars 15 forks source link

K2 compiler support #102

Closed mvarnagiris closed 11 months ago

mvarnagiris commented 1 year ago

With K2 compiler coming it would be good to make this library work with it too. Right now I'm getting this error:

Class SomeParcelableClass is not abstract and does not implement abstract member describeContents

K2 compiler enabled via kotlin.experimental.tryK2=true in gradle.properties

arkivanov commented 1 year ago

Thanks for raising! This issue is being tracked in: https://youtrack.jetbrains.com/issue/KT-58892.

mvarnagiris commented 1 year ago

Thanks for speedy response. I was not aware of that ticket. Feel free to close this 🙇

arkivanov commented 1 year ago

Seems like KT-58892 has been postponed until Kotlin 2.0.

arkivanov commented 1 year ago

Unfortunately, KT-58892 has been closed "As Designed", which means we'll have to migrate to `kotlinx-serialization".

mvarnagiris commented 1 year ago

Oh interesting. So the whole Parcelable thing will be replaced with serialization then? Seems like a huge change. I guess this will also affect Decompose.

arkivanov commented 1 year ago

Yes. Basically, the following feature will not work in K2.

// commonMain

expect annotation class Parcelize
expect interface Parcelable
// androidMain

actual typealias Parcelize = kotlinx.parcelize.Parcelize
actual typealias Parcelable = android.os.Parcelable

The API will have to change, but fortunately it should look very similar to the current one. Plus, it will be fully multiplatform.

arkivanov commented 1 year ago

Ideally, we would need a stable Efficient Binary Format in kotlinx-serialization. Filed https://github.com/Kotlin/kotlinx.serialization/issues/2428.

arkivanov commented 11 months ago

Fixed in #115.

arkivanov commented 11 months ago

Released in v1.3.0-alpha01.

hichamboushaba commented 3 months ago

@arkivanov it seems Kotlin-parcelize was updated to allow using it from the common code, are there any plans for restoring the support for Parcelable now?

I'm asking just to decide if I should start working on the migration to @Serializable or if I should postpone it.

arkivanov commented 3 months ago

Indeed, Parcelize can now be used from the common code. However, I really like how kotlinx-serialization works and supports all platforms. There are no plans to go back to Parcelize for now.