Parcelable: Fix signature for Serializable Parcel serializer (KT-19749)
This commit is contained in:
committed by
Yan Zhulanow
parent
32c02161cd
commit
eee28d8507
+2
-2
@@ -194,8 +194,8 @@ interface ParcelSerializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type.isSerializable() -> NullCompliantObjectParcelSerializer(asmType,
|
type.isSerializable() -> NullCompliantObjectParcelSerializer(asmType,
|
||||||
Method("writeSerializable"),
|
Method("writeSerializable", "(Ljava/io/Serializable;)V"),
|
||||||
Method("readSerializable"))
|
Method("readSerializable", "()Ljava/io/Serializable;"))
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
if (strict && !type.annotations.hasAnnotation(RAWVALUE_ANNOTATION_FQNAME))
|
if (strict && !type.annotations.hasAnnotation(RAWVALUE_ANNOTATION_FQNAME))
|
||||||
|
|||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
@file:JvmName("TestKt")
|
||||||
|
package test
|
||||||
|
|
||||||
|
import kotlinx.android.parcel.*
|
||||||
|
import android.os.Parcel
|
||||||
|
import android.os.Parcelable
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
class MHelp(var m1: String): Serializable {
|
||||||
|
val m2 = 9
|
||||||
|
}
|
||||||
|
|
||||||
|
@Parcelize
|
||||||
|
class M(val m: @RawValue MHelp) : Parcelable
|
||||||
|
|
||||||
|
fun box() = parcelTest { parcel ->
|
||||||
|
val test = M(MHelp("A"))
|
||||||
|
test.writeToParcel(parcel, 0)
|
||||||
|
|
||||||
|
val bytes = parcel.marshall()
|
||||||
|
parcel.unmarshall(bytes, 0, bytes.size)
|
||||||
|
|
||||||
|
val test2 = readFromParcel<M>(parcel)
|
||||||
|
|
||||||
|
assert(test.m.m1 == test2.m.m1)
|
||||||
|
}
|
||||||
Vendored
+6
-4
@@ -21,9 +21,11 @@ public static class User$Creator : java/lang/Object, android/os/Parcelable$Creat
|
|||||||
NEW
|
NEW
|
||||||
DUP
|
DUP
|
||||||
ALOAD (1)
|
ALOAD (1)
|
||||||
INVOKEVIRTUAL (android/os/Parcel, readSerializable, ()LSerializableSimple;)
|
INVOKEVIRTUAL (android/os/Parcel, readSerializable, ()Ljava/io/Serializable;)
|
||||||
|
CHECKCAST
|
||||||
ALOAD (1)
|
ALOAD (1)
|
||||||
INVOKEVIRTUAL (android/os/Parcel, readSerializable, ()LSerializableSimple;)
|
INVOKEVIRTUAL (android/os/Parcel, readSerializable, ()Ljava/io/Serializable;)
|
||||||
|
CHECKCAST
|
||||||
INVOKESPECIAL (User, <init>, (LSerializableSimple;LSerializableSimple;)V)
|
INVOKESPECIAL (User, <init>, (LSerializableSimple;LSerializableSimple;)V)
|
||||||
ARETURN
|
ARETURN
|
||||||
LABEL (L1)
|
LABEL (L1)
|
||||||
@@ -63,11 +65,11 @@ public final class User : java/lang/Object, android/os/Parcelable {
|
|||||||
ALOAD (1)
|
ALOAD (1)
|
||||||
ALOAD (0)
|
ALOAD (0)
|
||||||
GETFIELD (notNull, LSerializableSimple;)
|
GETFIELD (notNull, LSerializableSimple;)
|
||||||
INVOKEVIRTUAL (android/os/Parcel, writeSerializable, (LSerializableSimple;)V)
|
INVOKEVIRTUAL (android/os/Parcel, writeSerializable, (Ljava/io/Serializable;)V)
|
||||||
ALOAD (1)
|
ALOAD (1)
|
||||||
ALOAD (0)
|
ALOAD (0)
|
||||||
GETFIELD (nullable, LSerializableSimple;)
|
GETFIELD (nullable, LSerializableSimple;)
|
||||||
INVOKEVIRTUAL (android/os/Parcel, writeSerializable, (LSerializableSimple;)V)
|
INVOKEVIRTUAL (android/os/Parcel, writeSerializable, (Ljava/io/Serializable;)V)
|
||||||
RETURN
|
RETURN
|
||||||
LABEL (L1)
|
LABEL (L1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,4 +46,5 @@ class ParcelBoxTest : AbstractParcelBoxTest() {
|
|||||||
fun testEnums() = doTest("enums")
|
fun testEnums() = doTest("enums")
|
||||||
fun testObjects() = doTest("objects")
|
fun testObjects() = doTest("objects")
|
||||||
fun testNestedParcelable() = doTest("nestedParcelable")
|
fun testNestedParcelable() = doTest("nestedParcelable")
|
||||||
|
fun testKt19749() = doTest("kt19749")
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user