Skip to content

@Inject Validation

Henry edited this page May 19, 2020 · 6 revisions
  • Dagger does not support injection into private constructors

  • Dagger does not support injection into private fields

  • Dagger does not support injection into private methods

  • @Qualifier annotations are not allowed on @Inject constructors

  • @Scope annotations are not allowed on @Inject constructors; annotate the class instead

  • @Inject is nonsense on the constructor of an abstract class

  • @Inject fields may not be final

  • Dagger does not support injection into static fields

  • Dagger does not support injection into static methods

  • Methods with @Inject may not be abstract

  • Types may only contain one @Inject constructor

  • Dagger does not support checked exceptions on @Inject constructors

  • @Inject constructors are invalid on inner classes. Did you mean to make the class static?

  • A single binding may not declare more than one @Scope

  • Methods with @Inject may not declare type parameters

  • Methods with @Inject may not throw checked exceptions. Please wrap your exceptions in a RuntimeException instead.

  • Dagger does not support injection into private classes

  • Dagger does not support injection into Kotlin objects

Clone this wiki locally