title: Dagger2 creating a map of concrete instances fails with "cannot be provided without an @Provides-annotate"
body: <p>I am playing around with Dagger collection, in particular with map.</p>
  
  <p>I want to use Dagger2 to inject a map whose key is an enum and the values a concrete
  implementation of an interface. The map
  is injected in a presenter. An unique component instantiates the presenter, an
  activity uses the instantiation to display the strings produced by the value
  of the map.</p>
  
  <p>I get the following error:</p>
  
  <pre class="lang-sh prettyprint-override"><code>e: ../DaggerMap/app/build/tmp/kapt3/stubs/debug/com/aklal/briquedagger2/MainComponent.java:7: error: [Dagger/MissingBinding] java.util.Map&lt;com.aklal.briquedagger2.Lapse.TIME,? extends com.aklal.briquedagger2.Lapse.ChristmasTime&gt; cannot be provided without an @Provides-annotated method.
  public abstract interface MainComponent {
                  ^
        java.util.Map&lt;com.aklal.briquedagger2.Lapse.TIME,? extends com.aklal.briquedagger2.Lapse.ChristmasTime&gt; is injected at
            com.aklal.briquedagger2.MainPresenter(mapOfLapse)
        com.aklal.briquedagger2.MainPresenter is injected at
            com.aklal.briquedagger2.MainModule.getMainPresenter(connection)
        com.aklal.briquedagger2.Presenter is provided at
            com.aklal.briquedagger2.MainComponent.presenter()
  
  FAILURE: Build failed with an exception.
  </code></pre>
  
  <p>The "project" can be found <a href="https://github.com/Aklal/DaggerMap" rel="nofollow noreferrer">here</a></p>
  
  <h2>Implementation</h2>
  
  <p>I have an interface <code>ChristmasTime</code> which is implemented by two classes:</p>
  
  <ul>
  <li><code>TimeUntilNextChristmas</code></li>
  <li><code>TimeSinceLastChristmas</code></li>
  </ul>
  
  <p>These implementation are similarly simply defined as follow:</p>
  
  <pre><code>class TimeSinceLastChristmas @Inject constructor(): ChristmasTime {
      override fun getLapseOfTime() = "SINCE TEST"
  }    
  </code></pre>
  
  <p>I want to let Dagger2 create a map with</p>
  
  <ul>
  <li>an enum value as key</li>
  <li><code>ChristmasTime</code> as type value</li>
  </ul>
  
  <p>The key value is defined as follow:</p>
  
  <pre><code>@MapKey
  annotation class TimeKey(val value: TIME)
  
  enum class TIME {
      UNTIL,
      SINCE
  }
  </code></pre>
  
  <p>I created a module to provide concrete implementations of type <code>ChristmasTime</code>:</p>
  
  <pre><code>@Module
  interface LapseOfTimeModule {
      @Binds
      @IntoMap
      @TimeKey(TIME.UNTIL)
      fun provideLapsesOfTimeUntil(t: TimeUntilNextChristmas): ChristmasTime
  
      @Binds
      @IntoMap
      @TimeKey(TIME.SINCE)
      fun provideLapsesOfTimeSince(t: TimeSinceLastChristmas): ChristmasTime
  }
  </code></pre>
  
  <p>I want to displayed the string returned by the concrete implementations on the
  screen. To do so, a presenter communicates with an activity the strings contained
  in the map (that has been injected in the presenter):</p>
  
  <pre><code>class MainPresenter @Inject constructor(
      private val mapOfLapse: Map&lt;TIME, ChristmasTime&gt;
  ) : Presenter {
      override fun getDateUntil(): String = mapOfLapse[TIME.UNTIL]?.getLapseOfTime() ?: "UNTIL FAILED"
  }
  </code></pre>
  
  <p>The component to instantiate the presenter in the MainActivity takes the module that defines the map (<code>LapseOfTimeModule</code>) and a <code>MainModule</code></p>
  
  <pre><code>@Component(modules = [MainModule::class, LapseOfTimeModule::class])
  interface MainComponent {
      fun presenter(): Presenter
  }
  </code></pre>
  
  <p><code>MainModule</code> is:</p>
  
  <pre><code>@Module
  interface MainModule {
      @Binds
      fun getMainPresenter(connection: MainPresenter): Presenter
  }
  </code></pre>
  
  <p>And the <code>MainActivity</code> is:</p>
  
  <pre><code>class MainActivity : AppCompatActivity() {
  
      @Inject
      lateinit var presenter: Presenter
  
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
          presenter = DaggerMainComponent.create().presenter()
  
          bttDisplayNewDate.setOnClickListener{
              displayDate(
                  presenter.getDateSince(),
                  presenter.getDateUntil()
              )
          }
      }
  
      fun displayDate(since: String, until: String) {
          tvSince.text = since
          tvUntil.text = until
      }
  }
  </code></pre>
  
  <p>Does anyone know how to fix that ?</p>
  
  <p>Here are some threads that I read but they did not help much:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/46435424/kotlin-dagger-2-android-viewmodel-injection-error">Kotlin dagger 2 Android ViewModel injection error</a></li>
  <li><a href="https://stackoverflow.com/questions/57633347/dagger2-inherited-subcomponent-multibindings">Dagger2 Inherited subcomponent multibindings</a></li>
  </ul>
  
  <p>Thanks in advance!!</p>
  
  <p>ps: The version of dagger used is <code>2.24</code> and kotlin version is <code>1.3.41</code></p>