Parcelable: Provide quick fixes for custom Parceler support

This commit is contained in:
Yan Zhulanow
2017-09-14 23:03:56 +03:00
parent a63aca08f2
commit 2034b1f075
8 changed files with 166 additions and 0 deletions
@@ -0,0 +1,17 @@
// "Annotate with ''@Parcelize''" "true"
// ERROR: Class 'Foo' should be annotated with ''@Parcelize''
// WITH_RUNTIME
package com.myapp.activity
import android.os.*
import kotlinx.android.parcel.*
object StringParceler : Parceler<String> {
override fun create(parcel: Parcel) = TODO()
override fun String.write(parcel: Parcel, flags: Int) = TODO()
}
@Parcelize
@TypeParceler<String, StringParceler>
class Foo(<caret>val a: String) : Parcelable
@@ -0,0 +1,15 @@
// "Annotate containing class with ''@Parcelize''" "true"
// ERROR: Class 'Foo' should be annotated with ''@Parcelize''
// WITH_RUNTIME
package com.myapp.activity
import android.os.*
import kotlinx.android.parcel.*
object StringParceler : Parceler<String> {
override fun create(parcel: Parcel) = TODO()
override fun String.write(parcel: Parcel, flags: Int) = TODO()
}
class Foo(@<caret>TypeParceler<String, StringParceler> val a: String)
@@ -0,0 +1,17 @@
// "Remove redundant ''@TypeParceler'' annotation" "true"
// WARNING: This annotation duplicates the one for Class 'Foo'
// WITH_RUNTIME
package com.myapp.activity
import android.os.*
import kotlinx.android.parcel.*
object StringParceler : Parceler<String> {
override fun create(parcel: Parcel) = TODO()
override fun String.write(parcel: Parcel, flags: Int) = TODO()
}
@Parcelize
@TypeParceler<String, StringParceler>
class Foo(<caret>val a: String) : Parcelable
@@ -0,0 +1,17 @@
// "Remove redundant ''@TypeParceler'' annotation" "true"
// WARNING: This annotation duplicates the one for Class 'Foo'
// WITH_RUNTIME
package com.myapp.activity
import android.os.*
import kotlinx.android.parcel.*
object StringParceler : Parceler<String> {
override fun create(parcel: Parcel) = TODO()
override fun String.write(parcel: Parcel, flags: Int) = TODO()
}
@Parcelize
@TypeParceler<String, StringParceler>
class Foo(@<caret>TypeParceler<String, StringParceler> val a: String) : Parcelable