square / anvil

A Kotlin compiler plugin to make dependency injection with Dagger 2 easier.
Apache License 2.0
1.29k stars 76 forks source link

Support setter/method injection in factory gen #905

Open ZacSweers opened 4 months ago

ZacSweers commented 4 months ago

Dagger's member injection also supports injecting via method calls, i.e.

@Inject
fun injectDep(value: String) {
  // No fields here, just functional injection
}

We currently get close with @set:Inject support on properties, and after #899 merges we'll have a nice structure to add this support to