title: Kotlin getParcelableArray from intent bundle not able to cast it to custom type
body: <p>I am running into a weird problem . I have a class A which implements Parcelable interface in kotlin.</p>
  
  <p>I am passing the array of class A from one activity to another no issues here.</p>
  
  <pre><code> var arrayOfA:Array&lt;A&gt; // just to tell the type assume the array is initialised with the value
   intent.putExtra("array", arrayOfA)
  </code></pre>
  
  <p>But while receiving it in another activity , I am not able to assign it to variable of type Array it is asking me to assign it to Array when A is on type parcelable why I am not able to assign it the variable. </p>
  
  <pre><code>in second Activity 
  var arrayOfA:Array&lt;A&gt;?=null
  
  
  arrayA=intent.get("array") as Array&lt;A&gt; // Problem here. Class cast exception
  </code></pre>
  
  <p>I am not able to understand why. Can some one help me here. I don't want to change the type of variable to Array as it as many inter depedencies.(The class here is just a demonstration)</p>
  
  <p>========================================</p>
  
  <pre><code>class A(val a:String?,val b:String?):Parcelable {
      constructor(parcel: Parcel) : this(
              parcel.readString(),
              parcel.readString()) {
      }
  
      override fun writeToParcel(parcel: Parcel, flags: Int) {
          parcel.writeString(a)
          parcel.writeString(b)
      }
  
      override fun describeContents(): Int {
          return 0
      }
  
      companion object CREATOR : Parcelable.Creator&lt;A&gt; {
          override fun createFromParcel(parcel: Parcel): A {
              return A(parcel)
          }
  
          override fun newArray(size: Int): Array&lt;A?&gt; {
              return arrayOfNulls(size)
          }
      }
  }
  </code></pre>