Has anyone seen an issue like the following with K...
# ksp
s
Has anyone seen an issue like the following with Kotlin 2.2 / KSP 2.2.0-2.0.2? / KSP2 enabled?
Copy code
> A failure occurred while executing com.google.devtools.ksp.gradle.KspAAWorkerAction
   > Error while resolving ksp.org.jetbrains.kotlin.fir.declarations.impl.FirRegularClassImpl 
     from RAW_FIR to STATUS
     current declaration phase STATUS
     origin: Source
     session: class ksp.org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSourcesSession (Kotlin reflection is not available)
     module data: class ksp.org.jetbrains.kotlin.analysis.low.level.api.fir.projectStructure.LLFirModuleData (Kotlin reflection is not available)
     KaModule: class ksp.org.jetbrains.kotlin.analysis.project.structure.impl.KaSourceModuleImpl (Kotlin reflection is not available)
     platform: JVM (21)
Untitled
Managed to get ahold of a stacktrace, reported here as well: https://github.com/google/ksp/issues/2542
j
We're also running into this & it's preventing us from upgrading Kotlin. This happens to us periodically, only in CI, in Android modules (AGP 8.12) that also have Java, if that makes any difference Can't imagine this matters but for us, it's during Android Lint
We're noticing that the issue is resolved in Kotlin 2.2.20
kodee happy 1
s
I'm still seeing the same issue after bumping the dependencies unfortunately
j
You were right so I created a modified version of our build that uses a fork of KSP 2.0.2 that logs what symbol it's processing before resolving the
primaryConstructor
. Across several failing builds, it was always the same source file For us, it was a source file for a nested class within a class that had annotated properties in its primary constructor. Not that helpful but after rerunning a bunch of builds, it hasn't come up again. That doesn't mean it won't cause a crash on a different file, but for now, the issue is mitigated
Copy code
class Parent(
  @Something private val ...,
  @SomethingElse private val ...,
) {
  interface Foo
  class Bar : Foo { ... }
}
In our case
@Something
and
@SomethingElse
were Dagger Qualifiers but it was nonsensical usage because the constructor was not annotated with
@Inject
s
Oh wow, this is awesome, thank you for sharing this
t
I'm also having this issue, and I don't think I'll be able to make significant changes to the project using the generator to mitigate it. Is there some way to force reflection to be present on the classpath during compilation? Upgrading to
2.2.20-2.0.3
didn't seem to help.
Copy code
* What went wrong:
Execution failed for task ':dialector-kt-processor:kspTestKotlin'.
> A failure occurred while executing com.google.devtools.ksp.gradle.KspAAWorkerAction
   > Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath
I'm not really sure how to proceed - was very much hoping to bring this project up to 2.0+ but this error is a bit of a hard block.
This is happening for me in a test module I have defined, so it's very easy to reproduce, thankfully.