You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue might actually be related to KSP itself, but in my project auto-dagger I run my tests concurrently using Junit 5. This works fine for tests that use a regular annotation processor but fails for KSP tests (you essentially get a bunch of errors during type resolution like org.jetbrains.kotlin.resolve.lazy.NoDescriptorForDeclarationException: Descriptor wasn't found for declaration CLASS).
I'm surprised that it works at all. KotlinCompilation uses a thread-local singleton object to register KAPT processors, ComponentRegistrars and so on, since the compiler can only find them through classpath scanning. Parallel execution should thus always come with a risk of race conditions unless you can guarantee a dedicated thread per compilation. Does the KSP source code itself use parallel test execution?
Since it's all synchronous otherwise I think each test would run in a dedicated thread. But the threads would probably be reused but that must work or it wouldn't work running multiple tests.
I spawn no new threads in my processor or tests. In fact I didn't even think it was possible.
This issue might actually be related to KSP itself, but in my project auto-dagger I run my tests concurrently using Junit 5. This works fine for tests that use a regular annotation processor but fails for KSP tests (you essentially get a bunch of errors during type resolution like
org.jetbrains.kotlin.resolve.lazy.NoDescriptorForDeclarationException: Descriptor wasn't found for declaration CLASS
).To repro, comment out this line: https://github.com/ansman/auto-dagger/blob/main/compiler/src/test/kotlin/se/ansman/dagger/auto/compiler/KspTest.kt#L6
And then run the tests.
Again this issue might be with KSP and if so please just close this issue and I'll open an issue with KSP.
The text was updated successfully, but these errors were encountered: