Hi, we've updated a project to `1.9.0-Beta` but wh...
# k2-adopters
j
Hi, we've updated a project to
1.9.0-Beta
but when we try to enable k2 compile we're getting following (
Config
implements
Parcelable)
...anyone aware of any known issues around this?
Copy code
Object DefaultAppComponent.Config.Loading is not abstract and does not implement abstract member describeContents
k
Quick YouTrack search didn't show any known issues. Could you please file an issue with some reproduction code?
j
Actually, we did see following but it's marked as fixed it seems https://youtrack.jetbrains.com/issue/KT-53651 (or at least the one it's linked to)
It can be reproduced by adding
kotlin.experimental.tryK2=true
to
gradle.properties
of following project - https://github.com/joreilly/Confetti
k
Thanks, I'm investigating it.
j
fyi @Arkadii Ivanov
I see issue is still shown as open so assume fix didn't make it in to 1.9.10?
k
It didn't. And in fact there is a fundamental architectural problem that cannot be worked around. I've updated the issue description with a bit of explanation. Basically, while K1 compiled common and platform sources together for each platform, K2 only compiles common sources once and there's no way to 1. correctly resolve the annotation because the actual annotations aren't part of the compilation and 2. you could not generate different code for different platforms @Arkadii Ivanov do you have the possibility to raise this issue with the Parcelize team at Google?
a
I could, but I would like to understand what should be done on the Google side?
The kotlin-parcelize plugin is in the Kotlin repository, right? I assume it's maintained by JB, right? https://github.com/JetBrains/kotlin/tree/master/plugins/parcelize
I think a solution would be to extract all annotations (and only annotations) to a separate common module, and let the runtime module expose that as API? Or maybe just convery runtime to common, and place annotations in commonMain, and the rest in androidMain.
k
The kotlin-parcelize plugin is in the Kotlin repository, right? I assume it's maintained by JB, right? https://github.com/JetBrains/kotlin/tree/master/plugins/parcelize
I think it's officially maintained by Google despite being in the Kotlin repo.
a
Ah ok, thanks! I will try to find someone.
That it means that expect/actual annotations won't work with K2? This sounds like a big limitation, might be blocking for people in different cases.
k
For plugins? expect/actual is not the problem because the fully qualified name of the annotation stays the same. But typealiases to plugin annotation don't work.
a
Yes, I mean expect/actual annotations with typealiases. Thanks for the clarification, sad though. 🫣
k
Again, even if we could expand the typealias (which is not without its problems), the real problem is that frontend plugins are only run once for common code in K2. So you wouldn't be able to generate any platform specific declarations. It could potentially work with IR (backend) plugins...
👍 1
a
So e.g. the following use case will be broken as well? https://twitter.com/indiana_sloan/status/1694426595585331538
k
Depends on whether the annotation is checked at runtime or at build time by the plugin.
a
I might be wrong but I believe it's compile time.
Unfortunately, KT-58892 has been closed "As Designed", which means I'll have to migrate to `kotlinx-serialization". This is being tracked here: https://github.com/arkivanov/Essenty/issues/102
k
Just a heads-up. Using Parcelize with common code will become possible after all in 2.0.0-RC1. See https://issuetracker.google.com/issues/315775835#comment16.