title: Dagger 2 public field injection produces 'private field injection' error
body: <p>I'm trying to set up a very basic field injection using <code>Dagger2</code> with the following structure:</p>
  
  <pre><code>class ToInject {}
  </code></pre>
  
  <pre><code>class Injected {
      @Inject
      var toInject: ToInject? = null
  }
  </code></pre>
  
  <pre><code>@Module
  object BaseModule {
  
      var toInject: ToInject? = null
  
      @Provides
      @JvmStatic
      fun toInjectProvider(): ToInject {
          if (toInject == null) {
              toInject = ToInject()
          }
  
          return toInject as ToInject
  
      }
  }
  </code></pre>
  
  <p>The field I'm trying to inject is definately <strong>PUBLIC</strong> but the compiler returns the following error</p>
  
  <blockquote>
    <p>Dagger does not support injection into private fields</p>
  </blockquote>
  
  <p>Can anyone please explain why am I getting this error and how to fix it?</p>
  
  <p>BTW constructor injection works:</p>
  
  <pre><code>class Injected @Inject constructor(var toInject: ToInject){}
  </code></pre>