title: Kotlin out-projected type prohibits the use
body: <p>I recently tried the following in Kotlin.
  The idea is that I will receive as input an <code>Item</code> (like <code>AmericanItem</code> for instance) that extends <code>BaseItem</code>.
  I am trying to have a different parser for each of theses items
  Here is a sample code</p>
  
  <pre><code>abstract class BaseItem
  class AmericanItem : BaseItem()
  class EuropeanItem : BaseItem()
  
  interface ItemParser&lt;T : BaseItem&gt; {
      fun parse(item: T)
  }
  
  class AmericanItemParser : ItemParser&lt;AmericanItem&gt; {
      override fun parse(item: AmericanItem) {
          println("AmericanItemParser")
      }
  }
  
  class EuropeanItemParser : ItemParser&lt;EuropeanItem&gt; {
      override fun parse(item: EuropeanItem) {
          println("parsing EuropeanItem")
      }
  }
  
  fun main(args: Array&lt;String&gt;) {
      val hashMap = HashMap&lt;Class&lt;out BaseItem&gt;, ItemParser&lt;*&gt;&gt;()
      hashMap.put(AmericanItem::class.java, EuropeanItemParser())
      hashMap.put(EuropeanItem::class.java, AmericanItemParser())
  
      val inputItem = EuropeanItem()
      val foundParser = hashMap[inputItem.javaClass]
      foundParser?.parse(inputItem)
  }
  </code></pre>
  
  <p>My issue is at the very last line, when I am trying to invoke the parser, I am getting the following compilation error</p>
  
  <pre><code>Out-projected type 'ItemParser&lt;*&gt;?' prohibits the use of 'public abstract fun parse(item: T): kotlin.Unit defined in ItemParser'
  </code></pre>
  
  <p>What am I doing wrong here ? </p>