Open Ea87 opened 2 years ago
I've done some digging. We get this issue when an annotation processor depends on outputs of another annotation processor configured in the same target and code for both is generated with KAPT. This is the case in @Ea87's example.
If I check out the repro commit and do:
cd examples/dagger
bazelisk test //... --define=kt_trace=1
that will print Correct error types: true
when running KAPT so there's nothing wrong with the flag being passed. What is interesting though is that coffee_lib-kapt-gensrc.jar
generated by that KAPT action looks like you'd expect, with no reference to NonExistentClass
, while coffee_lib-kapt-generated-stub.jar
still references the class. More specifically, the generated FooFactory
in CoffeeMaker
is still replaced with NonExistentClass
. Possibly related to KT-35124.
I got the same problem
Our project (unfortunately) still uses AutoFactory, and a couple other legacy in-house APs that require enabling 'non-existent type correction' in kapt; While the rules currently explicitly disable this flag (https://github.com/bazelbuild/rules_kotlin/issues/634), we maintain a fork of 1.5.0 with the flag enabled, which has allowed us to keep support for these APs. Seems like the recent changes in 1.6.0 (likely removing the legacy javac compilation - https://github.com/bazelbuild/rules_kotlin/pull/694) have broken this support; Trying to use a generated factory class from AutoFactory now fails with:
I pushed the repro above here: https://github.com/Ea87/rules_kotlin/commit/aa52e47332e05c1825fd1ace2ee29fda24eef498
I know that AutoFactory is sorta deprecated and we should move away from it (and the other APs) but perhaps there's an easy workaround here to keep this supported (even just in our fork) while we migrate away from these?