tschuchortdev / kotlin-compile-testing

A library for testing Kotlin and Java annotation processors, compiler plugins and code generation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kapt processor not running when compiled code contains expect modifier (ksp works)

micHar opened this issue · comments

It can be reproduced with this repo and this specific test: https://github.com/FutureMind/koru/blob/5137cf168bcffb1c29ce9e50d1b7ef8c67ebed77/koru-processor/src/jvmTest/kotlin/com/futuremind/koru/processor/TypesGenerationTest.kt#L1117

Any other test works fine for both ksp and kapt processors, but this particular one compiles code with expect modifier. It works for ksp, but for kapt the processor is never even started. I cannot see any errors or meaningful warnings, it just fails to start.

This is somewhat connected to #303.

Hmm it seems like the problem might be with kapt, from my quick tests it ignores annotation processing on expect classes in production code as well... Let me know if this issue is relevant at all, otherwise I think it might be closed.

I just tested it myself and the annotation processor is run correctly on other Kotlin sources even when expect classes are present. It makes sense that KAPT doesn't run on multiplatform classes since KAPT simply converts the class to an equivalent Java class that can be processed by Java APT.