tschuchortdev / kotlin-compile-testing

A library for testing Kotlin and Java annotation processors, compiler plugins and code generation
Mozilla Public License 2.0
658 stars 63 forks source link

Annotated class is not recognized by KSP processor #270

Closed NorbertSandor closed 2 years ago

NorbertSandor commented 2 years ago

I try 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.) Maybe do you have an idea what am I doing wrong? Example test file: https://github.com/kotlinw/kotlinw/blob/main/kotlinw-immutator-processor/src/test/kotlin/kotlinw/immutator/processor/TestKsp.kt

NorbertSandor commented 2 years ago

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(): image

tschuchortdev commented 2 years ago

Unfortunately, I have no idea how this could happen. Perhaps different compiler flags could cause the embedded compiler to behave differently? Let me know if you find out.

NorbertSandor commented 2 years ago

Thanks. This solved the problem: inheritClassPath = true

nesk commented 1 year ago

Thank you @NorbertSandor, I had the same issue and using inheritClassPath = true works like a charm!