Files
kotlin-fork/plugins/parcelize/parcelize-ide/testData/quickfix/deleteIncompatible/writeToParcel.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

33 lines
806 B
Kotlin
Vendored

// "Remove custom ''writeToParcel()'' function" "true"
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead
// WITH_STDLIB
package com.myapp.activity
import android.os.*
import kotlinx.parcelize.Parcelize
@Parcelize
class Foo(val a: String) : Parcelable {
constructor(parcel: Parcel) : this(parcel.readString()) {
}
<caret>override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeString(a)
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<Foo> {
override fun createFromParcel(parcel: Parcel): Foo {
return Foo(parcel)
}
override fun newArray(size: Int): Array<Foo?> {
return arrayOfNulls(size)
}
}
}