Kotlin kapt: generating code through annotation processors: cannot find symbol (of generated classes) in stubs


#1

I have a module with annotation processor which generates quite lot of classes I use throughout the project.

I used that module in one of my projects, though it was hell to make it work properly, it works as expected - I run build, it generates classes and everything’s fine.

In new project, I use the same module (just copied code), the same config etc. but if I run build, in stubs it replaces all my “to be generated classes” references as Class, and build fails.

Workaround is that I use kaptKotlin task separately: it generates code, and than I have to build again (kapt again is run there but no errors thrown) and only than it works.

But even in kaptKotlin task I get lot’s of e: cannot find symbol in generated stubs (though code is generated).

I think that while running that tasks those should be ignored or something.

How can I correct that behavior?

Or how can I make it work through single “build” task, so kapt would in stubs reference “to be generated code” correctly and not replacing with Class?

P.S. using latest versions of Kotlin. Tried correctErrorTypes = true - no success.