You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that the KSP processors that are enabled when useKsp(true, false) is invoked within the AnvilExtension do not support multi-round processing. In particular, if the module depends on another KSP processor that generates code that is meant to be consumed by Anvil, it won't be able to resolve that type. One example is we'll generate a type that is then member injected so when Anvil tries to generate the member injector for the enclosing class, we get:
e: [ksp] java.lang.IllegalArgumentException: Error type '<ERROR TYPE>' is not resolvable in the current round of processing.
at com.squareup.kotlinpoet.ksp.KsTypesKt.toTypeName(KsTypes.kt:64)
at com.squareup.kotlinpoet.ksp.KsTypesKt.toTypeName(KsTypes.kt:58)
at com.squareup.anvil.compiler.codegen.dagger.DaggerGenerationUtilsKt.toMemberInjectParameter(DaggerGenerationUtils.kt:465)
at com.squareup.anvil.compiler.codegen.dagger.DaggerGenerationUtilsKt.declaredMemberInjectParameters(DaggerGenerationUtils.kt:282)
at com.squareup.anvil.compiler.codegen.dagger.DaggerGenerationUtilsKt.memberInjectParameters(DaggerGenerationUtils.kt:260)
at com.squareup.anvil.compiler.codegen.dagger.MembersInjectorCodeGen$KspGenerator.processChecked(MembersInjectorCodeGen.kt:82)
at com.squareup.anvil.compiler.codegen.ksp.AnvilSymbolProcessor.process(AnvilSymbolProcessing.kt:31)
I've supplied two patches: the first is for a very silly KSP processor that is configured in the way I've described above to reproduce this stacktrace (try running ./gradlew :delegate:sample:library:assemble) and the second is just naively applying the recommendations of the KSP documentation for multi-round processing by deferring invalid symbols within MemberInjectorCodeGen, although I would assume that this sort of change would need to be applied to each KSP processor within Anvil
It appears that the KSP processors that are enabled when
useKsp(true, false)
is invoked within theAnvilExtension
do not support multi-round processing. In particular, if the module depends on another KSP processor that generates code that is meant to be consumed by Anvil, it won't be able to resolve that type. One example is we'll generate a type that is then member injected so when Anvil tries to generate the member injector for the enclosing class, we get:I've supplied two patches: the first is for a very silly KSP processor that is configured in the way I've described above to reproduce this stacktrace (try running
./gradlew :delegate:sample:library:assemble
) and the second is just naively applying the recommendations of the KSP documentation for multi-round processing by deferring invalid symbols withinMemberInjectorCodeGen
, although I would assume that this sort of change would need to be applied to each KSP processor within Anvil0001-failing-project.patch
0002-Fix-MemberInjectorCodeGen.patch
The text was updated successfully, but these errors were encountered: