Running this code:
@Component(dependencies = [FooDependencies::class])
interface FooComponent {
fun getFooFactory(): FooFactory
@Component.Builder
interface Builder {
fun dependencies(dependencies: FooDependencies): Builder
fun build(): FooComponent
}
@AssistedFactory
interface FooFactory {
fun create(
@Assisted(KEY_FOO) foo: Boolean,
): Foo
companion object {
internal const val KEY_FOO = "KEY_FOO"
}
}
}
// 👇 Notice the @Inject instead of @AssistedInject
class Foo @Inject constructor(
@Assisted(KEY_FOO) private val foo: Boolean,
)
will result in a simple e: [ksp] java.lang.IllegalArgumentException compilation error.
A better error would be helpful, as it is quite common to switch to an @AssistedInject strategy and forget about the constructor annotation.