anvil icon indicating copy to clipboard operation
anvil copied to clipboard

MembersInjectorGenerator will generate nullable type args for nullable injections

Open ZacSweers opened this issue 4 years ago • 0 comments

Perhaps this is correct behavior, but to my knowledge Dagger does not allow nulls to be passed through directly.

class Example @Inject constructor() {
  @Inject
  var injected: String? = null
}

Will result in member injection refs like this

public class Example_Factory(
  private val param0: Provider<String?>
) : Factory<Example> {
  public override fun get(): Example {
    val instance = newInstance()
    Example_MembersInjector.injectInjected(instance, param0.get())
    return instance
  }
}

ZacSweers avatar Jul 02 '21 04:07 ZacSweers