KSP2 error "Packages cannot be imported"
G00fY2 opened this issue · 2 comments
G00fY2 commented
We are using Moshi codegen via KSP for a while. We tried to test KSP2 via ksp.useKSP2=true
along with kotlin.experimental.tryK2=true
but we get build errors for generated Moshi adapters:
e: file:///Users/twirth/AndroidStudioProjects/android-client/common/common-entity/build/generated/ksp/main/kotlin/com/company/entities/common/ecom/CategoryFilterJsonAdapter.kt:14:8 Packages cannot be imported
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':common:common-entity:compileKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
KSP2 is complaining because of the import kotlin
line in the generated adapter classes.
Is this something Moshi can/needs to fix or should I report this issue to the KSP team?
Kotlin: 1.9.21, Moshi: 1.15.0, Gradle: 8.5
ZacSweers commented
Do you have a minimallly reproducing code snippet?
G00fY2 commented
I can not reproduce it with current/stable Kotlin releasesn anymore.