This is a blast from the past: ```Caused by: ksp.o...
# kotlin-inject
r
This is a blast from the past:
Copy code
Caused by: ksp.org.jetbrains.kotlin.analysis.api.lifetime.KaInvalidLifetimeOwnerAccessException: Access to invalid ksp.org.jetbrains.kotlin.analysis.api.platform.lifetime.KotlinAlwaysAccessibleLifetimeToken@33adf999: PSI has changed since creation
        at ksp.org.jetbrains.kotlin.analysis.api.fir.symbols.KaFirNamedFunctionSymbol.getPsi(KaFirNamedFunctionSymbol.kt:247)
        at com.google.devtools.ksp.impl.symbol.kotlin.UtilKt.toContainingFile(util.kt:237)
        at com.google.devtools.ksp.impl.symbol.kotlin.AbstractKSDeclarationImpl$containingFile$2.invoke(AbstractKSDeclarationImpl.kt:79)
        at com.google.devtools.ksp.impl.symbol.kotlin.AbstractKSDeclarationImpl$containingFile$2.invoke(AbstractKSDeclarationImpl.kt:78)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:83)
        at com.google.devtools.ksp.impl.symbol.kotlin.AbstractKSDeclarationImpl.getContainingFile(AbstractKSDeclarationImpl.kt:78)
        at me.tatarka.kotlin.ast.KSAstProvider.addOriginatingElement(KSAst.kt:94)
        at me.tatarka.inject.compiler.KmpComponentCreateGenerator.generate(KmpComponentCreateGenerator.kt:27)
        at me.tatarka.inject.compiler.ksp.ProcessKmpComponentCreateKt.generateKmpComponentCreateFiles(ProcessKmpComponentCreate.kt:40)
        at me.tatarka.inject.compiler.ksp.InjectProcessor.finish(InjectProcessor.kt:113)
I can reproduce this consistently in unit tests for all platforms where I define the function in
commonTest
Copy code
@KmpComponentCreate
expect fun createTestComponent(
  coroutineScope: CoroutineScope,
  coroutineDispatcher: CoroutineDispatcher,
): TestComponent
This happens only with KSP 2, there’s no issue with KSP 1 obviously.
e
That was the error related to caching KSP objects I think. Odd that it would pop up again.
r
Yep, I fixed one or two in kotlin-inject myself. I'm not using this annotation a lot, so it seems to be just another case that was missed before.
e
Are you using the snapshot that has KSP2 support?
r
No, last stable, which is quite old. The slow releases are painful.
I used to maintain a fork internally, but this is about an open source project.
e
The snapshot should have a bunch of fixes for that issue
A release would be nice...
👍 1
d
Will there be such a fix for the kotlin-inject without anvil?
e
It's fixed in kotlin-inject, but a release hasn't been made with those changes yet.
d
Alright, can you give some planned date?
e
I can't, I'm not the maintainer 😅
d
If you know him, let him know 🙂
Is kotlin-inject-anvil a super set of kotlin-inject?
e
@ralf can probably explain better, but I believe kotlin-inject-anvil is built on top of kotlin-inject
r
@Daniel Weidensdörfer Create an issue on Github? I’m maintaining kotlin-inject-anvil. No, it’s not a superset, but an extension. But given the multiple problems of kotlin-inject, we may consider forking the core at some point.
👀 1