title: Kotlin generics Array<T> results in "Cannot use T as a reified type parameter. Use a class instead" but List<T> does not
body: <p>I have an interface that contains an array (or list) of T and some metadata.</p>
  
  <pre><code>interface DataWithMetadata&lt;T&gt; {
      val someMetadata: Int
      fun getData(): Array&lt;T&gt;
  }
  </code></pre>
  
  <p>If I write the simplest implementation of the interface, I get a compile error on the <code>emptyArray()</code>: "Cannot use T as a reified type parameter. Use a class instead."</p>
  
  <pre><code>class ArrayWithMetadata&lt;T&gt;(override val someMetadata: Int): DataWithMetadata&lt;T&gt; {
      private var myData: Array&lt;T&gt; = emptyArray()
  
      override fun getData(): Array&lt;T&gt; {
          return myData
      }
  
      fun addData(moreData: Array&lt;T&gt;) {
          this.myData += moreData
      }
  }
  </code></pre>
  
  <p>However, if I change both the interface and the implementation to a list, I have no compile-time issues:</p>
  
  <pre><code>interface DataWithMetadata&lt;T&gt; {
      val someMetadata: Int
      fun getData(): List&lt;T&gt;
  }
  
  class ListWithMetadata&lt;T&gt;(override val someMetadata: Int): DataWithMetadata&lt;T&gt; {
      private var myData: List&lt;T&gt; = emptyList()
  
      override fun getData(): List&lt;T&gt; {
          return myData
      }
  
      fun addData(moreData: Array&lt;T&gt;) {
          this.myData += moreData
      }
  }
  </code></pre>
  
  <p>I suspect there is some interesting lesson in Kotlin generics inside my issue. Can anyone tell me what the compiler is doing under the hood and why Array fails but List does not? Is there an idiomatic way to make the Array implementation compile in this context?</p>
  
  <p>Bonus question: The only reason I reached for Array over List is that I often see Kotlin developers favor Arrays. Is this the case, and if so, why?</p>