title: Does Kotlin's "@Parcelize" work with non data classes?
body: <p>I have simple data classes. I mean, they are data classes logically, but not <code>data class</code>, because I need inheritance and other constructors. They only have fields (of basic types <code>Int?</code>, <code>String?</code>, or <code>List&lt;String&gt;?</code>, etc), and constructors.</p>
  
  <p>I need to pass them (all of their fields need to be passed) from Activity to Activity, so I need to make them parcellisable (or is there a better way?). I first created them as <code>data class</code> and just added <code>@Parcelize</code>. Even though there was a warning and red line that said "CREATOR" or something, I could ignore them and the app worked as intended.</p>
  
  <p>But, now for the reasons above, I changed them to normal classes, and suddenly there is a compilation error.</p>
  
  <pre><code>Error:java.util.NoSuchElementException: Collection contains no element matching the predicate.
      at org.jetbrains.kotlin.android.parcel.ParcelableCodegenExtension.getPropertiesToSerialize(ParcelableCodegenExtension.kt:374)
      ....too long...
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
  
  Error:Execution failed for task ':app:kaptGenerateStubsDebugKotlin'. Internal compiler error. See log for more details
  </code></pre>
  
  <p>How can I solve this problem? Should I use <code>data class</code>? But I need to parse a JSON object to create them. The classes look like these (not actual classes, but simplified for illustration purposes). Is there a better way than implementing that boring, bulky parcellable code by hand?</p>
  
  <pre><code>@Parcelize
  open class Dog():Parcelable
  {
      var someField1;
      var someField2;
      constructor(data:JSON):this()
      {
         //parse data to set the fields.
      }
  }
  
  @Parcelize
  class Doge:Dog
  {
      var someField3;
      var someField4;
  
      constructor():super(); //I do not use it, but for parcellable
      constructor(data:JSON):super(data)
      {
         //parse data to set the fields.
      }
  }
  </code></pre>
  
  <hr>
  
  <p>PS. I had to switch to PaperParcel. It was very similar to Kotlin's, but it did not require a primary constructor. It only required the same thing to be any constructor, so I could just create a secondary constructor with the same argument names as those of fields, and it worked. Although, I wonder why the CREATOR could not be created automatically.</p>
  
  <p>For example,</p>
  
  <pre><code>@PaperParcel
  class Doge:Dog
  {
      var someField3;
      var someField4;
  
      //Needed only for PaperParcel
      constructor(someField3, someField4)
      {
         this.someField3 = someField3;
         this.someField4 = someField4;
      }
      companion object
      {
          @JvmField val CREATOR = PaperParcelDoge.CREATOR
      }
      //end of PaperParcel stuff.
  
      constructor(data:JSON):super(data)
      {
         //parse data to set the fields.
      }
  }
  </code></pre>