title: Can I use Dagger 2's field injection in Kotlin?
body: <p>I posted a question (<a href="https://stackoverflow.com/questions/47247696/dagger-2-does-not-generate-the-component-class-android-kotlin">Dagger 2 does not generate the component class (Android, Kotlin)</a>), and after some experiments, it seems that the problem might be due to that Kotlin hides the field.</p>
  
  <pre><code>class CoffeeShop {
      @Inject
      var theCoffee: Coffee? = null
  }
  </code></pre>
  
  <p>The error message is,</p>
  
  <pre><code>:app:kaptDebugKotline: ...\CoffeeShop.java:7:
  error: Dagger does not support injection into private fields
  e:     private ....Coffee theCoffee;
  </code></pre>
  
  <p><code>theCoffee</code> was not private in my source code. But I think Kotlin may be translating</p>
  
  <pre><code>class CoffeeShop {
      @Inject
      var theCoffee: Coffee? = null
  }
  </code></pre>
  
  <p>into Java code of</p>
  
  <pre><code>class CoffeeShop {
      @Inject
      private Coffee theCoffee = null;
      public Coffee getTheCoffee();
      public void setTheCoffee();
  }
  </code></pre>
  
  <p>Can I use field injection in Kotlin?</p>