forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
Kotlin: 2.1.21
Dagger: 2.56.2
Anvil-KSP: 0.4.1
KSP: 2.1.20-2.0.1
In an api module:
interface Foo {
interface Factory {
fun create(dependency: Dependency): Foo
}
}In an impl module:
class FooImpl @AssistedInject constructor(
@Assisted dependency: Dependency,
) : Foo {
@ContributesBinding(AppScope::class)
@AssistedFactory
interface Factory : Foo.Factory {
override fun create(dependency: Dependency): FooImpl
}
}Then somewhere in the code:
@SingleIn(AppScope:class)
class MyThing @Inject constructor(
fooFactory: Foo.Factory,
)
This code always compiles and works locally. But the kspReleaseKotlin task often fails on CI. There are 2 possible errors, and the same build might pass when restarted.
Possible failure 1:
* What went wrong:
Execution failed for task ':app:kspReleaseKotlin'.
> A failure occurred while executing com.google.devtools.ksp.gradle.KspAAWorkerAction
> expected one element but was: <create, create>
Possible failure 2:
e: [ksp] [com.example.Foo.Factory.create(com.example.Dependency)] Invalid return type: com.example.Foo. An assisted factory's abstract method must return a type with an @AssistedInject-annotated constructor.
e: [ksp] The @AssistedFactory-annotated type should contain a single abstract, non-default method but found multiple: [com.example.Foo.Factory.create(com.example.Dependency), com.example.FooImpl.Factory.create(com.example.Dependency)]
I think this started to happen after we updated Kotlin from 2.0.21 to 2.1.20, Dagger from 2.52 to 2.56.2 and KSP from 2.0.21-1.0.26 to 2.1.20-2.0.1.
Metadata
Metadata
Assignees
Labels
No labels