https://kotlinlang.org logo
Title
n

Norbi

05/30/2022, 11:44 AM
Does anyone use this project for testing? https://github.com/tschuchortdev/kotlin-compile-testing I tried to use this library but my pet example class is not recognized by the processor. (When I use "real" ksp processing it works as expected.) Example test file: https://github.com/kotlinw/kotlinw/blob/main/kotlinw-immutator-processor/src/test/kotlin/kotlinw/immutator/processor/TestKsp.kt Thanks.
m

Matthias Geisler

05/30/2022, 11:57 AM
Yes - maybe this helps.
:tnx: 1
n

Norbi

05/30/2022, 12:15 PM
To give some more insights: if I debug into the processing, my annotation type is not resolvable at the following line when calling `annotationType.resolveToUnderlying()`:
m

Matthias Geisler

05/30/2022, 12:30 PM
I can recall I had some problems without given the tests a custom buildDir
n

Norbi

05/30/2022, 12:46 PM
I can recall I had some problems without given the tests a custom buildDir
This did not solve it unfortunatelly 😞 But thanks for the tip, and the kmock project seems very interesting 👍🏻
m

Matthias Geisler

05/30/2022, 12:48 PM
Thx - however is the symbol picked up during the test?
(symbol == KSAnnotated)
n

Norbi

05/30/2022, 12:59 PM
Hm, the annotation itself (
@Immutate
in my case) seems to be inaccessible by the KSP process. Maybe the annotation and its processor should be in the same project? I give it a try...
"Maybe the annotation and its processor should be in the same project" - nope... :\
m

Matthias Geisler

05/30/2022, 1:04 PM
It looks like it does not know about the Annotation
👍🏻 1
perhaps setting
inheritClassPath
to
true
does the trick
1
n

Norbi

05/30/2022, 1:06 PM
That was it!!! Thank you very much 🙏🏻 🙂
m

Matthias Geisler

05/30/2022, 1:09 PM
Always a pleasure!
:thank-you: 1