title: Migrate to the new kotlin-parcelize
body: <p>Can anyone please explain how to migrate to the <a href="https://android-developers.googleblog.com/2020/11/the-future-of-kotlin-android-extensions.html" rel="noreferrer">new</a> <code>kotlin-parcelize</code>?</p>
  <p>I tried:</p>
  <ol>
  <li>Replace <code>apply plugin: 'kotlin-android-extensions'</code> with <code>apply plugin: 'kotlin-parcelize'</code> in app build.gradle</li>
  <li>Replace <code>import kotlinx.android.parcel.Parcelize</code> with <code>import kotlinx.parcelize.Parcelize</code></li>
  </ol>
  <p>The latter one leads to</p>
  <pre><code>Class 'ParcelZonedDateTime' is not abstract and does not implement abstract member public abstract fun describeContents(): Int defined in android.os.Parcelable
  </code></pre>
  <p>on e.g. this code:</p>
  <pre><code>import androidx.annotation.Keep
  import kotlinx.parcelize.Parcelize
  import org.threeten.bp.ZonedDateTime
  
  @Keep
  @Parcelize
  data class ParcelZonedDateTime(var value: ZonedDateTime?) :Parcelable {
      override fun toString(): String {
          return value.toString()
      }
  }
  </code></pre>
  <p>So, how to migrate to the new <code>kotlin-parcelize</code>?</p>
  <p><strong>Update:</strong></p>
  <p>Based on comments: Yes, I am on Kotlin 1.4.20 (which is newer than 1.4.20-M2).Kyzer is right that the error in the IDE (<em>is not abstract and does not implement abstract member public abstract fun describeContents()</em>) can and has to be ignored. Yet I have an issue where I use Generics:</p>
  <pre><code>import android.os.Parcelable
  import kotlinx.parcelize.Parcelize
  
  sealed class MyDialogEvent {
      @Parcelize
      data class Confirmed&lt;T: Parcelable&gt;(val identity: String, val data: T) : Parcelable
  }
  </code></pre>
  <p>The generated code for this is</p>
  <pre><code>@kotlin.Metadata(mv = {1, 4, 1}, bv = {1, 0, 3}, k = 3)
  public static final class Creator implements android.os.Parcelable.Creator&lt;com.example.stackoverflow.MyDialogEvent.Confirmed&gt; {
      
      public Creator() {
          super();
      }
      
      @org.jetbrains.annotations.NotNull()
      @java.lang.Override()
      public final com.example.stackoverflow.MyDialogEvent.Confirmed&lt;T&gt;[] newArray(int size) {
          return null;
      }
      
      @org.jetbrains.annotations.NotNull()
      @java.lang.Override()
      public final com.example.stackoverflow.MyDialogEvent.Confirmed&lt;T&gt; createFromParcel(@org.jetbrains.annotations.NotNull()
      android.os.Parcel in) {
          return null;
      }
  }
  </code></pre>
  <p>and during compilation I get this error for it (line numbers won't match the sample code, but you can easily identify the matching lines by comparing the method names):</p>
  <pre><code>MyDialogEvent.java:167: error: non-static type variable T cannot be referenced from a static context
              public final com.example.stackoverflow.MyDialogEvent.Confirmed&lt;T&gt;[] newArray(int size) {
                                                                                         
  MyDialogEvent.java:173: error: non-static type variable T cannot be referenced from a static context
              public final com.example.stackoverflow.MyDialogEvent.Confirmed&lt;T&gt; createFromParcel(@org.jetbrains.annotations.NotNull()
  </code></pre>