Parcelable: Add quick fixes
This commit is contained in:
committed by
Yan Zhulanow
parent
8eeed17b65
commit
e6171dc4c5
Vendored
+2
-2
@@ -10,7 +10,7 @@ class A : Parcelable
|
||||
class B(val firstName: String, val secondName: String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
class C(val firstName: String, <error descr="[PLUGIN_ERROR] PARCELABLE_CONSTRUCTOR_PARAMETER_SHOULD_BE_VAL_OR_VAR: 'Parcelable' constructor parameter should be 'val' or 'var'">secondName</error>: String) : Parcelable
|
||||
class C(val firstName: String, <error descr="[PARCELABLE_CONSTRUCTOR_PARAMETER_SHOULD_BE_VAL_OR_VAR] 'Parcelable' constructor parameter should be 'val' or 'var'">secondName</error>: String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
class D(val firstName: String, vararg val secondName: String) : Parcelable
|
||||
@@ -21,7 +21,7 @@ class E(val firstName: String, val secondName: String) : Parcelable {
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class <error descr="[PLUGIN_ERROR] PARCELABLE_SHOULD_HAVE_PRIMARY_CONSTRUCTOR: 'Parcelable' should have a primary constructor">F</error> : Parcelable {
|
||||
class <error descr="[PARCELABLE_SHOULD_HAVE_PRIMARY_CONSTRUCTOR] 'Parcelable' should have a primary constructor">F</error> : Parcelable {
|
||||
constructor(a: String) {
|
||||
println(a)
|
||||
}
|
||||
|
||||
+3
-3
@@ -6,16 +6,16 @@ import android.os.Parcel
|
||||
|
||||
@Parcelize
|
||||
class A(val a: String) : Parcelable {
|
||||
<error descr="[PLUGIN_ERROR] OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.">override</error> fun writeToParcel(p: Parcel?, flags: Int) {}
|
||||
<error descr="[OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED] Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.">override</error> fun writeToParcel(p: Parcel?, flags: Int) {}
|
||||
override fun describeContents() = 0
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class B(val a: String) : Parcelable {
|
||||
<error descr="[PLUGIN_ERROR] OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.">override</error> fun writeToParcel(p: Parcel?, flags: Int) {}
|
||||
<error descr="[OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED] Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.">override</error> fun writeToParcel(p: Parcel?, flags: Int) {}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class C(val a: String) : Parcelable {
|
||||
<error descr="[PLUGIN_ERROR] OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.">override</error> fun writeToParcel(p: Parcel, flags: Int) {}
|
||||
<error descr="[OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED] Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.">override</error> fun writeToParcel(p: Parcel, flags: Int) {}
|
||||
}
|
||||
Vendored
+1
-1
@@ -10,4 +10,4 @@ open class Delegate : Parcelable {
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class Test : Parcelable <error descr="[PLUGIN_ERROR] PARCELABLE_DELEGATE_IS_NOT_ALLOWED: Delegating 'Parcelable' is now allowed">by</error> Delegate()
|
||||
class Test : Parcelable <error descr="[PARCELABLE_DELEGATE_IS_NOT_ALLOWED] Delegating 'Parcelable' is now allowed">by</error> Delegate()
|
||||
+1
-1
@@ -7,4 +7,4 @@ import android.os.Parcelable
|
||||
class User : Parcelable
|
||||
|
||||
@Parcelize
|
||||
class <warning descr="[PLUGIN_WARNING] PARCELABLE_PRIMARY_CONSTRUCTOR_IS_EMPTY: The primary constructor is empty, no data will be serialized to 'Parcel'">User2</warning>() : Parcelable
|
||||
class <warning descr="[PARCELABLE_PRIMARY_CONSTRUCTOR_IS_EMPTY] The primary constructor is empty, no data will be serialized to 'Parcel'">User2</warning>() : Parcelable
|
||||
Vendored
+1
-1
@@ -17,4 +17,4 @@ class Foo(val box: Box): Parcelable {
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class Foo2(val box: <error descr="[PLUGIN_ERROR] PARCELABLE_TYPE_NOT_SUPPORTED: Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Box</error>): Parcelable
|
||||
class Foo2(val box: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Box</error>): Parcelable
|
||||
Vendored
+5
-5
@@ -10,22 +10,22 @@ open class Open(val foo: String) : Parcelable
|
||||
class Final(val foo: String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
<error descr="[PLUGIN_ERROR] PARCELABLE_SHOULD_BE_INSTANTIABLE: 'Parcelable' should not be a 'sealed' or 'abstract' class">abstract</error> class Abstract(val foo: String) : Parcelable
|
||||
<error descr="[PARCELABLE_SHOULD_BE_INSTANTIABLE] 'Parcelable' should not be a 'sealed' or 'abstract' class">abstract</error> class Abstract(val foo: String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
<error descr="[PLUGIN_ERROR] PARCELABLE_SHOULD_BE_INSTANTIABLE: 'Parcelable' should not be a 'sealed' or 'abstract' class">sealed</error> class Sealed(val foo: String) : Parcelable {
|
||||
<error descr="[PARCELABLE_SHOULD_BE_INSTANTIABLE] 'Parcelable' should not be a 'sealed' or 'abstract' class">sealed</error> class Sealed(val foo: String) : Parcelable {
|
||||
class X : Sealed("")
|
||||
}
|
||||
|
||||
class Outer {
|
||||
@Parcelize
|
||||
<error descr="[PLUGIN_ERROR] PARCELABLE_CANT_BE_INNER_CLASS: 'Parcelable' can't be an inner class">inner</error> class Inner(val foo: String) : Parcelable
|
||||
<error descr="[PARCELABLE_CANT_BE_INNER_CLASS] 'Parcelable' can't be an inner class">inner</error> class Inner(val foo: String) : Parcelable
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
@Parcelize
|
||||
<error descr="[PLUGIN_ERROR] PARCELABLE_SHOULD_BE_CLASS: 'Parcelable' should be a class">object</error> : Parcelable {}
|
||||
<error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">object</error> : Parcelable {}
|
||||
|
||||
@Parcelize
|
||||
class <error descr="[PLUGIN_ERROR] NO_PARCELABLE_SUPERTYPE: No 'Parcelable' supertype"><error descr="[PLUGIN_ERROR] PARCELABLE_CANT_BE_LOCAL_CLASS: 'Parcelable' can't be a local class">Local</error></error> {}
|
||||
class <error descr="[NO_PARCELABLE_SUPERTYPE] No 'Parcelable' supertype"><error descr="[PARCELABLE_CANT_BE_LOCAL_CLASS] 'Parcelable' can't be a local class">Local</error></error> {}
|
||||
}
|
||||
Vendored
+3
-3
@@ -5,11 +5,11 @@ import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class A(val firstName: String) : Parcelable {
|
||||
val <warning descr="[PLUGIN_WARNING] PROPERTY_WONT_BE_SERIALIZED: Property would not be serialized into a 'Parcel'. Add '@Transient' annotation to remove the warning">secondName</warning>: String = ""
|
||||
val <warning descr="[PROPERTY_WONT_BE_SERIALIZED] Property would not be serialized into a 'Parcel'. Add '@Transient' annotation to remove the warning">secondName</warning>: String = ""
|
||||
|
||||
val <warning descr="[PLUGIN_WARNING] PROPERTY_WONT_BE_SERIALIZED: Property would not be serialized into a 'Parcel'. Add '@Transient' annotation to remove the warning">delegated</warning> by lazy { "" }
|
||||
val <warning descr="[PROPERTY_WONT_BE_SERIALIZED] Property would not be serialized into a 'Parcel'. Add '@Transient' annotation to remove the warning">delegated</warning> by lazy { "" }
|
||||
|
||||
lateinit var <warning descr="[PLUGIN_WARNING] PROPERTY_WONT_BE_SERIALIZED: Property would not be serialized into a 'Parcel'. Add '@Transient' annotation to remove the warning">lateinit</warning>: String
|
||||
lateinit var <warning descr="[PROPERTY_WONT_BE_SERIALIZED] Property would not be serialized into a 'Parcel'. Add '@Transient' annotation to remove the warning">lateinit</warning>: String
|
||||
|
||||
val customGetter: String
|
||||
get() = ""
|
||||
|
||||
+3
-3
@@ -7,9 +7,9 @@ import android.os.Parcelable
|
||||
@Parcelize
|
||||
class User(
|
||||
val a: String,
|
||||
val b: <error descr="[PLUGIN_ERROR] PARCELABLE_TYPE_NOT_SUPPORTED: Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Any</error>,
|
||||
val c: <error descr="[PLUGIN_ERROR] PARCELABLE_TYPE_NOT_SUPPORTED: Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Any?</error>,
|
||||
val d: <error descr="[PLUGIN_ERROR] PARCELABLE_TYPE_NOT_SUPPORTED: Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Map<Any, String></error>,
|
||||
val b: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Any</error>,
|
||||
val c: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Any?</error>,
|
||||
val d: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Map<Any, String></error>,
|
||||
val e: @RawValue Any?,
|
||||
val f: @RawValue Map<String, Any>,
|
||||
val g: Map<String, @RawValue Any>,
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class <error descr="[PLUGIN_ERROR] NO_PARCELABLE_SUPERTYPE: No 'Parcelable' supertype">Without</error>(val firstName: String, val secondName: String, val age: Int)
|
||||
class <error descr="[NO_PARCELABLE_SUPERTYPE] No 'Parcelable' supertype">Without</error>(val firstName: String, val secondName: String, val age: Int)
|
||||
|
||||
@Parcelize
|
||||
class With(val firstName: String, val secondName: String, val age: Int) : Parcelable
|
||||
|
||||
+5
-5
@@ -4,22 +4,22 @@ import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
interface <error descr="[PLUGIN_ERROR] PARCELABLE_SHOULD_BE_CLASS: 'Parcelable' should be a class">Intf</error> : Parcelable
|
||||
interface <error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">Intf</error> : Parcelable
|
||||
|
||||
@Parcelize
|
||||
object <error descr="[PLUGIN_ERROR] PARCELABLE_SHOULD_BE_CLASS: 'Parcelable' should be a class">Obj</error>
|
||||
object <error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">Obj</error>
|
||||
|
||||
class A {
|
||||
@Parcelize
|
||||
companion <error descr="[PLUGIN_ERROR] PARCELABLE_SHOULD_BE_CLASS: 'Parcelable' should be a class">object</error> {
|
||||
companion <error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">object</error> {
|
||||
fun foo() {}
|
||||
}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
enum class <error descr="[PLUGIN_ERROR] PARCELABLE_SHOULD_BE_CLASS: 'Parcelable' should be a class">Enum</error> {
|
||||
enum class <error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">Enum</error> {
|
||||
WHITE, BLACK
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
annotation class <error descr="[PLUGIN_ERROR] PARCELABLE_SHOULD_BE_CLASS: 'Parcelable' should be a class">Anno</error>
|
||||
annotation class <error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">Anno</error>
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Add empty primary constructor" "true"
|
||||
// ERROR: 'Parcelable' should have a primary constructor
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class <caret>Test() : Parcelable {
|
||||
constructor(s: String) : this()
|
||||
constructor(s: String, i: Int) : this(s)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Add empty primary constructor" "true"
|
||||
// ERROR: 'Parcelable' should have a primary constructor
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class <caret>Test : Parcelable {
|
||||
constructor(s: String)
|
||||
constructor(s: String, i: Int) : this(s)
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Add empty primary constructor" "false"
|
||||
// IGNORE_IRRELEVANT_ACTIONS
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class <caret>Test() : Parcelable
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add empty primary constructor" "true"
|
||||
// ERROR: 'Parcelable' should have a primary constructor
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class <caret>Test() : Parcelable {
|
||||
constructor(a: Int) : this()
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add empty primary constructor" "true"
|
||||
// ERROR: 'Parcelable' should have a primary constructor
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class <caret>Test : Parcelable {
|
||||
constructor(a: Int)
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Remove 'inner' modifier" "true"
|
||||
// ERROR: 'Parcelable' can't be an inner class
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
class Foo {
|
||||
@Parcelize<caret>
|
||||
class Bar : Parcelable
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Remove 'inner' modifier" "true"
|
||||
// ERROR: 'Parcelable' can't be an inner class
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
class Foo {
|
||||
@Parcelize
|
||||
<caret>inner class Bar : Parcelable
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// "Remove custom ''CREATOR'' property" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val a: String) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(parcel.readString()) {
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(a)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
<caret>}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// "Remove custom ''CREATOR'' property" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val a: String) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(parcel.readString()) {
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(a)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val <caret>CREATOR = object : Parcelable.Creator<Foo> {
|
||||
override fun createFromParcel(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Foo?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// "Remove custom ''writeToParcel()'' function" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val a: String) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(parcel.readString()) {
|
||||
}
|
||||
|
||||
<caret>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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// "Remove custom ''writeToParcel()'' function" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parceler
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString(),
|
||||
parcel.readInt()) {
|
||||
}
|
||||
|
||||
<caret>companion object : Parceler<Foo> {
|
||||
|
||||
override fun Foo.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString(),
|
||||
parcel.readInt()) {
|
||||
}
|
||||
|
||||
<caret>override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parceler
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(parcel.readString(), parcel.readInt())
|
||||
|
||||
companion object : Parceler<Foo> {
|
||||
<caret>override fun Foo.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel): Foo = TODO()
|
||||
}
|
||||
|
||||
private abstract class Creator : Parcelable.Creator<Foo> {
|
||||
override fun createFromParcel(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Foo?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(parcel.readString(), parcel.readInt())
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val <caret>CREATOR: Parcelable.Creator<Foo> = object : Creator() {}
|
||||
}
|
||||
|
||||
private abstract class Creator : Parcelable.Creator<Foo> {
|
||||
override fun createFromParcel(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Foo?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parceler
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString(),
|
||||
parcel.readInt()) {
|
||||
}
|
||||
|
||||
<caret>override fun describeContents(): Int {
|
||||
return 50
|
||||
}
|
||||
|
||||
companion object : Parceler<Foo> {
|
||||
|
||||
override fun Foo.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString(),
|
||||
parcel.readInt()) {
|
||||
}
|
||||
|
||||
<caret>override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 50
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parceler
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString(),
|
||||
parcel.readInt()) {
|
||||
}
|
||||
|
||||
companion object <caret>: Parceler<Foo> {
|
||||
|
||||
override fun Foo.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString(),
|
||||
parcel.readInt()) {
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
companion object <caret>CREATOR : Parcelable.Creator<Foo> {
|
||||
override fun createFromParcel(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Foo?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parceler
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(parcel.readString(), parcel.readInt())
|
||||
|
||||
companion object : Parceler<Foo> {
|
||||
<caret>override fun Foo.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
}
|
||||
|
||||
private class Creator : Parcelable.Creator<Foo> {
|
||||
override fun createFromParcel(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Foo?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(parcel.readString(), parcel.readInt())
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val <caret>CREATOR: Parcelable.Creator<Foo> = Creator()
|
||||
}
|
||||
|
||||
private class Creator : Parcelable.Creator<Foo> {
|
||||
override fun createFromParcel(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Foo?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parceler
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(parcel.readString(), parcel.readInt())
|
||||
|
||||
companion object : Parceler<Foo> {
|
||||
<caret>override fun Foo.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(parcel.readString(), parcel.readInt())
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val <caret>CREATOR = object : Parcelable.Creator<Foo> {
|
||||
override fun createFromParcel(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Foo?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parceler
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString(),
|
||||
parcel.readInt()) {
|
||||
}
|
||||
|
||||
companion object <caret>: Parceler<Foo> {
|
||||
|
||||
fun Foo.write(parcel: Parcel, flags: Int) = TODO()
|
||||
override fun create(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString(),
|
||||
parcel.readInt()) {
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object <caret>CREATOR : Parcelable.Creator<Foo> {
|
||||
override fun createFromParcel(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Foo?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parceler
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString(),
|
||||
parcel.readInt()) {
|
||||
}
|
||||
|
||||
<caret>companion object : Parceler<Foo> {
|
||||
|
||||
override fun Foo.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel): Foo {
|
||||
return Foo(parcel)
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// "Migrate to ''Parceler'' companion object" "true"
|
||||
// ERROR: 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.
|
||||
// ERROR: Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.*
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Foo(val firstName: String, val age: Int) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString(),
|
||||
parcel.readInt()) {
|
||||
}
|
||||
|
||||
<caret>override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add ''Parcelable'' supertype" "false"
|
||||
// IGNORE_IRRELEVANT_ACTIONS
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
abstract class AbstractParcelable : Parcelable
|
||||
|
||||
@Parcelize
|
||||
class <caret>Test(val s: String) : AbstractParcelable()
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Add ''Parcelable'' supertype" "true"
|
||||
// ERROR: No 'Parcelable' supertype
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class <caret>Test(val s: String) : Parcelable
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Add ''Parcelable'' supertype" "true"
|
||||
// ERROR: No 'Parcelable' supertype
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class <caret>Test(val s: String)
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add ''@Transient'' annotation" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Test : Parcelable {
|
||||
@Transient
|
||||
val <caret>a = 5
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Add ''@Transient'' annotation" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
package com.myapp.activity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class Test : Parcelable {
|
||||
val <caret>a = 5
|
||||
}
|
||||
Reference in New Issue
Block a user