Parcelize: Add the Parcelize compiler plugin with sources extracted from Android Extensions plugin (KT-40030)
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class PrimitiveTypes(
|
||||
val boo: Boolean, val c: Char, val byt: Byte, val s: Short,
|
||||
val i: Int, val f: Float, val l: Long, val d: Double,
|
||||
|
||||
val nboo: Boolean?, val nc: Char?, val nbyt: Byte?, val ns: Short?,
|
||||
val ni: Int?, val nf: Float?, val nl: Long?, val nd: Double?,
|
||||
|
||||
val jboo: java.lang.Boolean, val jc: java.lang.Character, val jbyt: java.lang.Byte, val js: java.lang.Short,
|
||||
val ji: java.lang.Integer, val jf: java.lang.Float, val jl: java.lang.Long, val jd: java.lang.Double,
|
||||
|
||||
val njboo: java.lang.Boolean?, val njc: java.lang.Character?, val njbyt: java.lang.Byte?, val njs: java.lang.Short?,
|
||||
val nji: java.lang.Integer?, val njf: java.lang.Float?, val njl: java.lang.Long?, val njd: java.lang.Double?
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = PrimitiveTypes(
|
||||
true, '#', 3.toByte(), 10.toShort(), -300, -5.0f, Long.MAX_VALUE, 3.14,
|
||||
true, '#', 3.toByte(), 10.toShort(), -300, -5.0f, Long.MAX_VALUE, 3.14,
|
||||
true as java.lang.Boolean, '#' as java.lang.Character,
|
||||
3.toByte() as java.lang.Byte, 10.toShort() as java.lang.Short,
|
||||
-300 as java.lang.Integer, -5.0f as java.lang.Float,
|
||||
10L as java.lang.Long, 3.14 as java.lang.Double,
|
||||
true as java.lang.Boolean, '#' as java.lang.Character,
|
||||
3.toByte() as java.lang.Byte, 10.toShort() as java.lang.Short,
|
||||
-300 as java.lang.Integer, -5.0f as java.lang.Float,
|
||||
10L as java.lang.Long, 3.14 as java.lang.Double
|
||||
)
|
||||
val second = PrimitiveTypes(
|
||||
false, '\n', Byte.MIN_VALUE, Short.MIN_VALUE,
|
||||
Int.MIN_VALUE, Float.POSITIVE_INFINITY, Long.MAX_VALUE, Double.NEGATIVE_INFINITY,
|
||||
null, null, null, null, null, null, null, null,
|
||||
false as java.lang.Boolean, '\n' as java.lang.Character,
|
||||
Byte.MIN_VALUE as java.lang.Byte, Short.MIN_VALUE as java.lang.Short,
|
||||
Int.MIN_VALUE as java.lang.Integer, Float.POSITIVE_INFINITY as java.lang.Float,
|
||||
java.lang.Long(Long.MAX_VALUE), java.lang.Double(Double.NEGATIVE_INFINITY),
|
||||
null, null, null, null, null, null, null, null
|
||||
)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
second.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<PrimitiveTypes>(parcel)
|
||||
val second2 = readFromParcel<PrimitiveTypes>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
assert(second == second2)
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.Arrays
|
||||
|
||||
@Parcelize
|
||||
data class Test(val a: Array<String>) : Parcelable {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
|
||||
other as Test
|
||||
|
||||
if (!Arrays.equals(a, other.a)) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode() = Arrays.hashCode(a)
|
||||
}
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Test(arrayOf("A", "B"))
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.Arrays
|
||||
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val a: Array<String>,
|
||||
val b: Array<String?>,
|
||||
val c: IntArray,
|
||||
val d: CharArray?,
|
||||
val e: Array<IntArray>,
|
||||
val f: Array<List<String>>,
|
||||
val g: List<Array<String>>,
|
||||
val h: Array<String>?
|
||||
) : Parcelable {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
|
||||
other as Test
|
||||
|
||||
if (!Arrays.equals(a, other.a)) return false
|
||||
if (!Arrays.equals(b, other.b)) return false
|
||||
if (!Arrays.equals(c, other.c)) return false
|
||||
if (!Arrays.equals(d, other.d)) return false
|
||||
if (!Arrays.deepEquals(e, other.e)) return false
|
||||
if (!Arrays.equals(f, other.f)) return false
|
||||
|
||||
if (g.size != other.g.size) return false
|
||||
if (!g.zip(other.g).all { (f, s) -> Arrays.equals(f, s) }) return false
|
||||
|
||||
if (!Arrays.equals(h, other.h)) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = Arrays.hashCode(a)
|
||||
result = 31 * result + Arrays.hashCode(b)
|
||||
result = 31 * result + Arrays.hashCode(c)
|
||||
result = 31 * result + (d?.let { Arrays.hashCode(it) } ?: 0)
|
||||
result = 31 * result + Arrays.hashCode(e)
|
||||
result = 31 * result + Arrays.hashCode(f)
|
||||
result = 31 * result + g.hashCode()
|
||||
result = 31 * result + (h?.let { Arrays.hashCode(it) } ?: 0)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Test(
|
||||
a = arrayOf("A", "B", "C"),
|
||||
b = arrayOf("A", null, "B"),
|
||||
c = intArrayOf(1, 2, 3),
|
||||
d = null,
|
||||
e = arrayOf(intArrayOf(2, 4, 1), intArrayOf(10, 20)),
|
||||
f = arrayOf(listOf("A"), listOf("B", "C")),
|
||||
g = listOf(arrayOf("Z", "X"), arrayOf()),
|
||||
h = arrayOf("")
|
||||
)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// See KT-38103
|
||||
// There is no such thing as a readStrongInterface method to deserialize arbitrary IIinterface implementations
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Binder
|
||||
import android.os.IBinder
|
||||
import android.os.IInterface
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.io.Serializable
|
||||
|
||||
class MockBinder : Binder(), Serializable
|
||||
|
||||
@Parcelize
|
||||
class MockIInterface : IInterface, Parcelable {
|
||||
override fun asBinder(): IBinder = MockBinder()
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class ServiceContainer(
|
||||
val binder: MockBinder,
|
||||
val iinterface: MockIInterface,
|
||||
val binderArray: Array<IBinder>,
|
||||
val binderList: List<IBinder>
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = ServiceContainer(MockBinder(), MockIInterface(), arrayOf(MockBinder()), listOf(MockBinder()))
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<ServiceContainer>(parcel)
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class BoxedTypes(
|
||||
val boo: java.lang.Boolean,
|
||||
val c: java.lang.Character,
|
||||
val byt: java.lang.Byte,
|
||||
val s: java.lang.Short,
|
||||
val i: java.lang.Integer,
|
||||
val f: java.lang.Float,
|
||||
val l: java.lang.Long,
|
||||
val d: java.lang.Double
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = BoxedTypes(
|
||||
true as java.lang.Boolean,
|
||||
'#' as java.lang.Character,
|
||||
3.toByte() as java.lang.Byte,
|
||||
10.toShort() as java.lang.Short,
|
||||
-300 as java.lang.Integer,
|
||||
-5.0f as java.lang.Float,
|
||||
Long.MAX_VALUE as java.lang.Long,
|
||||
3.14 as java.lang.Double)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<BoxedTypes>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.os.Bundle
|
||||
|
||||
@Parcelize
|
||||
data class User(val a: Bundle) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = User(Bundle().apply { putChar("A", 'c'); putByte("B", 40.toByte()); putString("C", "ABC") })
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<User>(parcel)
|
||||
|
||||
assert(compareBundles(test.a, test2.a))
|
||||
}
|
||||
|
||||
private fun compareBundles(first: Bundle, second: Bundle): Boolean {
|
||||
if (first.size() != second.size()) return false
|
||||
|
||||
for (key in first.keySet()) {
|
||||
if (first.get(key) != second.get(key)) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.text.SpannableString
|
||||
|
||||
@Parcelize
|
||||
data class Test(val simple: CharSequence, val spanned: CharSequence) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = Test("John", SpannableString("Smith"))
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(test.simple.toString() == test2.simple.toString())
|
||||
assert(test.spanned.toString() == test2.spanned.toString())
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class User(val firstName: String, val secondName: String, val age: Int) : Parcelable {
|
||||
companion object : Parceler<User> {
|
||||
override fun User.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeString(secondName)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel) = User(parcel.readString(), parcel.readString(), 0)
|
||||
|
||||
override fun newArray(size: Int) = arrayOfNulls<User>(size) as Array<User>
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val user = User("John", "Smith", 20)
|
||||
val user2 = User("Joe", "Bloggs", 30)
|
||||
val array = arrayOf(user, user2)
|
||||
parcel.writeTypedArray(array, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val creator = User::class.java.getDeclaredField("CREATOR").get(null) as Parcelable.Creator<User>
|
||||
val result = parcel.createTypedArray(creator)
|
||||
|
||||
assert(result.size == 2)
|
||||
assert(result[0].firstName == user.firstName)
|
||||
assert(result[1].firstName == user2.firstName)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// See KT-38105
|
||||
// Throws IllegalAccessError, since the code tries to access the private companion field directly from the generated User$Creator class.
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
data class User(val name: String, val age: Int)
|
||||
|
||||
@Parcelize
|
||||
data class UserParcelable(val user: User) : Parcelable {
|
||||
private companion object : Parceler<UserParcelable> {
|
||||
override fun UserParcelable.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(user.name)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel) = UserParcelable(User(parcel.readString(), 0))
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val userParcelable = UserParcelable(User("John", 20))
|
||||
userParcelable.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val userParcelable2 = readFromParcel<UserParcelable>(parcel)
|
||||
|
||||
assert(userParcelable.user.name == userParcelable2.user.name)
|
||||
assert(userParcelable2.user.age == 0)
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.util.SparseBooleanArray
|
||||
|
||||
object Parceler1 : Parceler<Int> {
|
||||
override fun create(parcel: Parcel) = -parcel.readInt()
|
||||
|
||||
override fun Int.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeInt(this)
|
||||
}
|
||||
}
|
||||
|
||||
object Parceler2 : Parceler<Int> {
|
||||
override fun create(parcel: Parcel) = parcel.readString().length
|
||||
|
||||
override fun Int.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString("Abc")
|
||||
}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
@TypeParceler<Int, Parceler1>
|
||||
data class Ints(val a: Int, @TypeParceler<Int, Parceler2> val b: Int, val c: @WriteWith<Parceler2> Int) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = Ints(1, 1, 1)
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<Ints>(parcel)
|
||||
|
||||
assert(test2.a == -test.a)
|
||||
assert(test2.b == -test.b)
|
||||
assert(test2.c == 3)
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.Arrays
|
||||
|
||||
object Parceler1 : Parceler<Int> {
|
||||
override fun create(parcel: Parcel) = -parcel.readInt()
|
||||
|
||||
override fun Int.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeInt(this)
|
||||
}
|
||||
}
|
||||
|
||||
object Parceler2 : Parceler<Long> {
|
||||
override fun create(parcel: Parcel) = parcel.readString().length.toLong()
|
||||
|
||||
override fun Long.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString("Abc")
|
||||
}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val a: Int,
|
||||
@TypeParceler<Int, Parceler1> val b: Int,
|
||||
@TypeParceler<Long, Parceler2> val c: Long,
|
||||
@TypeParceler<Int, Parceler1> val d: List<Int>,
|
||||
@TypeParceler<Long, Parceler2> val e: LongArray
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = Test(5, 5, 50L, listOf(1, 2, 3), longArrayOf(3, 2, 1))
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<Test>(parcel)
|
||||
|
||||
println(test.toString())
|
||||
println(test2.toString())
|
||||
|
||||
with (test) {
|
||||
assert(a == 5 && b == 5 && c == 50L && d == listOf(1, 2, 3) && Arrays.equals(e, longArrayOf(3, 2, 1)))
|
||||
}
|
||||
|
||||
with (test2) {
|
||||
assert(a == 5 && b == -5 && c == 3L && d == listOf(-1, -2, -3) && Arrays.equals(e, longArrayOf(3, 3, 3)))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
object Parceler1 : Parceler<String> {
|
||||
override fun create(parcel: Parcel) = parcel.readInt().toString()
|
||||
|
||||
override fun String.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeInt(length)
|
||||
}
|
||||
}
|
||||
|
||||
typealias Parceler2 = Parceler1
|
||||
|
||||
object Parceler3 : Parceler<String> {
|
||||
override fun create(parcel: Parcel) = parcel.readString().toUpperCase()
|
||||
|
||||
override fun String.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(this)
|
||||
}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
@TypeParceler<String, Parceler2>
|
||||
data class Test(
|
||||
val a: String,
|
||||
@TypeParceler<String, Parceler1> val b: String,
|
||||
@TypeParceler<String, Parceler3> val c: CharSequence,
|
||||
val d: @WriteWith<Parceler3> String
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = Test("Abc", "Abc", "Abc", "Abc")
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(test.a == "Abc" && test.b == "Abc" && test.c == "Abc" && test.d == "Abc")
|
||||
assert(test2.a == "3" && test2.b == "3" && test2.c == "Abc" && test2.d == "ABC")
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// See KT-38107
|
||||
// The JVM backend is missing support for custom parcelers in List<String>
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
object Parceler1 : Parceler<String> {
|
||||
override fun create(parcel: Parcel) = parcel.readInt().toString()
|
||||
|
||||
override fun String.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeInt(length)
|
||||
}
|
||||
}
|
||||
|
||||
object Parceler2 : Parceler<List<String>> {
|
||||
override fun create(parcel: Parcel) = listOf(parcel.readString())
|
||||
|
||||
override fun List<String>.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(this.joinToString(","))
|
||||
}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val a: String,
|
||||
val b: @WriteWith<Parceler1> String,
|
||||
val c: List<@WriteWith<Parceler1> String>,
|
||||
val d: @WriteWith<Parceler2> List<String>,
|
||||
val e: @WriteWith<Parceler2> List<@WriteWith<Parceler1> String>
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = Test("Abc", "Abc", listOf("A", "bc"), listOf("A", "bc"), listOf("A", "bc"))
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<Test>(parcel)
|
||||
|
||||
with (test) {
|
||||
assert(a == "Abc" && b == "Abc" && c == listOf("A", "bc") && d == listOf("A", "bc") && e == listOf("A", "bc"))
|
||||
}
|
||||
|
||||
with (test2) {
|
||||
assert(a == "Abc" && b == "3" && c == listOf("1", "2") && d == listOf("A,bc") && e == listOf("A,bc"))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// See KT-38105
|
||||
// Throws IllegalAccessError, since the code tries to access the private companion field directly from the generated User$Creator class.
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class User(val firstName: String, val secondName: String, val age: Int) : Parcelable {
|
||||
private companion object : Parceler<User> {
|
||||
override fun User.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeString(secondName)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel) = User(parcel.readString(), parcel.readString(), 0)
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val user = User("John", "Smith", 20)
|
||||
user.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val user2 = readFromParcel<User>(parcel)
|
||||
|
||||
assert(user.firstName == user2.firstName)
|
||||
assert(user.secondName == user2.secondName)
|
||||
assert(user2.age == 0)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
enum class Color : Parcelable { BLACK, WHITE }
|
||||
|
||||
@Parcelize
|
||||
object Obj : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val black = Color.BLACK
|
||||
val obj = Obj
|
||||
|
||||
black.writeToParcel(parcel, 0)
|
||||
obj.writeToParcel(parcel, 0)
|
||||
|
||||
println(black)
|
||||
println(obj)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val black2 = readFromParcel<Color>(parcel)
|
||||
val obj2 = readFromParcel<Obj>(parcel)
|
||||
|
||||
println(black2)
|
||||
println(obj2)
|
||||
|
||||
assert(black2 == black)
|
||||
assert(obj2 != null)
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
enum class Color {
|
||||
BLACK, WHITE
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
data class Test(val name: String, val color: Color) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = Test("John", Color.WHITE)
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<Test>(parcel)
|
||||
assert(test == test2)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// Parcel.readException throws the exception it reads and only supports a small number of exception types.
|
||||
// If we have to parcel an exception we should instead use read/writeSerializable (compare KT-31830)
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class ExceptionContainer(val exn: Exception) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = ExceptionContainer(java.lang.RuntimeException("Don't throw me."))
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<ExceptionContainer>(parcel)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Test(val callback: () -> Int = { 0 }, val suspendCallback: suspend () -> Int = { 0 }) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = Test({ 1 }, { 1 })
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(test.callback() == 1)
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.Arrays
|
||||
|
||||
@Parcelize
|
||||
data class Film(val genres: Array<Int>) : Parcelable {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Film
|
||||
|
||||
if (!Arrays.equals(genres, other.genres)) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return Arrays.hashCode(genres)
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val film = Film(arrayOf(3, 5, 7))
|
||||
film.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val film2 = readFromParcel<Film>(parcel)
|
||||
assert(film == film2)
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// This issue affects AIDL generated files, as reported in KT-25807
|
||||
// WITH_RUNTIME
|
||||
// FILE: J.java
|
||||
import android.os.Parcel;
|
||||
import test.K;
|
||||
|
||||
public class J {
|
||||
public static K readParcel(Parcel parcel) {
|
||||
return K.CREATOR.createFromParcel(parcel);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class K(val x: Int) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = K(0)
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val second = J.readParcel(parcel)
|
||||
assert(first == second)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.io.Serializable
|
||||
|
||||
class JHelp(var j1: String) {
|
||||
val j2 = 9
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class J(val j: @RawValue JHelp) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = J(JHelp("A"))
|
||||
|
||||
var exceptionCaught = false
|
||||
try {
|
||||
test.writeToParcel(parcel, 0)
|
||||
} catch (e: RuntimeException) {
|
||||
if (e.message!!.contains("Parcel: unable to marshal value test.JHelp")) {
|
||||
exceptionCaught = true
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
if (!exceptionCaught) {
|
||||
error("Exception should be thrown")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.io.Serializable
|
||||
|
||||
interface IJHelp {
|
||||
val j1: String
|
||||
}
|
||||
|
||||
class JHelp(override var j1: String): IJHelp, Serializable {
|
||||
val j2 = 9
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class J(val j: @RawValue JHelp) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = J(JHelp("A"))
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<J>(parcel)
|
||||
|
||||
assert(test.j.j1 == test2.j.j1)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
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)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<M>(parcel)
|
||||
|
||||
assert(test.m.m1 == test2.m.m1)
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.Arrays
|
||||
|
||||
@Parcelize
|
||||
data class Test(val a: LongArray, val b: List<Long>) : Parcelable {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
|
||||
other as Test
|
||||
|
||||
if (!Arrays.equals(a, other.a)) return false
|
||||
if (b != other.b) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode() = Arrays.hashCode(a)
|
||||
}
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Test(longArrayOf(1, 2, 3, 4, 5), listOf(1, 2, 3, 4))
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// See KT-38106
|
||||
// This feature regressed with the fix for KT-22576
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.Arrays
|
||||
|
||||
enum class ParcelableEnum : Parcelable {
|
||||
ONE, TWO, THREE;
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeInt(ordinal)
|
||||
}
|
||||
|
||||
override fun describeContents() = 0
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val CREATOR: Parcelable.Creator<ParcelableEnum> = object : Parcelable.Creator<ParcelableEnum> {
|
||||
override fun createFromParcel(parcel: Parcel) = ParcelableEnum.ONE
|
||||
override fun newArray(size: Int) = arrayOfNulls<ParcelableEnum>(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class Test(val parcelableEnum: ParcelableEnum): Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Test(ParcelableEnum.THREE)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(first.parcelableEnum == ParcelableEnum.THREE)
|
||||
assert(first2.parcelableEnum == ParcelableEnum.ONE)
|
||||
assert(first != first2)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
fun box() = doTest { creator ->
|
||||
assert(creator.newArray(5) != null)
|
||||
}
|
||||
|
||||
fun doTest(work: (Parcelable.Creator<DummyParcelable>) -> Unit): String {
|
||||
val dummy = DummyParcelable(42)
|
||||
|
||||
val clazz = dummy.javaClass
|
||||
val field = clazz.getDeclaredField("CREATOR")
|
||||
val creator = field.get(dummy) as Parcelable.Creator<DummyParcelable>
|
||||
|
||||
val parcel = Parcel.obtain()
|
||||
dummy.writeToParcel(parcel, 0)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
work(creator)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
data class DummyParcelable(val int: Int): Parcelable
|
||||
@@ -0,0 +1,29 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class User : Parcelable
|
||||
|
||||
@Parcelize
|
||||
class User2() : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val user = User()
|
||||
val user2 = User2()
|
||||
|
||||
user.writeToParcel(parcel, 0)
|
||||
user2.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
readFromParcel<User>(parcel)
|
||||
readFromParcel<User2>(parcel)
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// Fails with a VerifyError in Foo.writeToParcel
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.util.SparseArray
|
||||
|
||||
@Parcelize
|
||||
data class PInt(val x: Int) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Foo(val values: SparseArray<SparseArray<Parcelable>>) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val pint = PInt(0)
|
||||
val sarray = SparseArray<Parcelable>()
|
||||
sarray.put(0, pint)
|
||||
val sarray2 = SparseArray<SparseArray<Parcelable>>()
|
||||
sarray2.put(1, sarray)
|
||||
val foo = Foo(sarray2)
|
||||
|
||||
foo.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val foo2 = readFromParcel<Foo>(parcel)
|
||||
assert(foo2.values.size() == 1)
|
||||
assert(foo2.values.get(1) != null) // SparseArray.contains was only added in Android R
|
||||
assert(foo2.values.get(1).size() == 1)
|
||||
assert(foo2.values.get(1).get(0) != null)
|
||||
assert(foo2.values.get(1).get(0) == pint)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// StackOverflowError caused by infinite loop in MyObject.writeToParcel
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
private object MyObject : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
MyObject.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
readFromParcel<MyObject>(parcel)
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize class TestParcel : Parcelable {
|
||||
companion object : Parceler<TestParcel> {
|
||||
override fun create(parcel: Parcel): TestParcel {
|
||||
return TestParcel()
|
||||
}
|
||||
override fun TestParcel.write(parcel: Parcel, flags: Int) {}
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
TestParcel()
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.*
|
||||
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val a: List<String>,
|
||||
val b: MutableList<String>,
|
||||
val c: ArrayList<String>,
|
||||
val d: LinkedList<String>,
|
||||
val e: Set<String>,
|
||||
val f: MutableSet<String>,
|
||||
val g: TreeSet<String>,
|
||||
val h: HashSet<String>,
|
||||
val i: LinkedHashSet<String>,
|
||||
val j: NavigableSet<String>,
|
||||
val k: SortedSet<String>
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Test(
|
||||
a = listOf("A"),
|
||||
b = mutableListOf("B"),
|
||||
c = ArrayList<String>().apply { this += "C" },
|
||||
d = LinkedList<String>().apply { this += "D" },
|
||||
e = setOf("E"),
|
||||
f = mutableSetOf("F"),
|
||||
g = TreeSet<String>().apply { this += "G" },
|
||||
h = HashSet<String>().apply { this += "H" },
|
||||
i = LinkedHashSet<String>().apply { this += "I" },
|
||||
j = TreeSet<String>().apply { this += "J" },
|
||||
k = TreeSet<String>().apply { this += "K" }
|
||||
)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
assert((first.d as LinkedList<*>).size == 1)
|
||||
assert((first2.h as HashSet<*>).size == 1)
|
||||
assert(first2.j is NavigableSet<*>)
|
||||
assert(first2.k is SortedSet<*>)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Test(val a: List<String>) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Test(listOf("A", "B"))
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val a: List<String>,
|
||||
val b: List<String?>,
|
||||
val c: List<Int>,
|
||||
val d: List<Int?>,
|
||||
val e: List<List<String>?>,
|
||||
val f: List<List<List<Int>>>
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Test(
|
||||
a = listOf("A", "B"),
|
||||
b = listOf("A", null, "C"),
|
||||
c = listOf(1, 2, 3),
|
||||
d = listOf(1, null, 5),
|
||||
e = listOf(listOf("A", "B"), listOf(), null),
|
||||
f = listOf(listOf(listOf(1, 2), listOf(3)), listOf(listOf(5, 3)))
|
||||
)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
|
||||
assert(first2.a == listOf("A", "B"))
|
||||
assert(first2.b.size == 3)
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.*
|
||||
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val a: Map<String, String>,
|
||||
val b: MutableMap<String, String>,
|
||||
val c: HashMap<String, String>,
|
||||
val d: LinkedHashMap<String, String>,
|
||||
val e: TreeMap<String, String>,
|
||||
val f: SortedMap<String, String>,
|
||||
val g: NavigableMap<String, String>
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Test(
|
||||
a = mapOf("A" to "B"),
|
||||
b = mutableMapOf("A" to "B"),
|
||||
c = HashMap<String, String>().apply { put("A", "B") },
|
||||
d = LinkedHashMap<String, String>().apply { put("A", "B") },
|
||||
e = TreeMap<String, String>().apply { put("A", "B") },
|
||||
f = TreeMap<String, String>().apply { put("A", "B") },
|
||||
g = TreeMap<String, String>().apply { put("A", "B") }
|
||||
)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
assert((first.c as HashMap<*, *>).size == 1)
|
||||
assert((first2.e as TreeMap<*, *>).size == 1)
|
||||
assert(first2.f is SortedMap<*, *>)
|
||||
assert(first2.g is NavigableMap<*, *>)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Test(val a: Map<String, String>) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Test(mapOf("A" to "B", "C" to "D"))
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val a: Map<String, String>,
|
||||
val b: Map<String?, String>,
|
||||
val c: Map<String, String?>,
|
||||
val d: Map<String, Map<Int, String>>,
|
||||
val e: Map<Int?, List<String>>,
|
||||
val f: Map<Boolean, Boolean>,
|
||||
val g: Map<String, Map<String, Map<String, String>>>
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Test(
|
||||
a = mapOf("A" to "B", "C" to "D"),
|
||||
b = mapOf("A" to "B", null to "D", "E" to "F"),
|
||||
c = mapOf("A" to null, "C" to "D"),
|
||||
d = mapOf("A" to mapOf(1 to "", 2 to "x")),
|
||||
e = mapOf(1 to listOf("", ""), null to listOf()),
|
||||
f = mapOf(true to false, false to true),
|
||||
g = mapOf("A" to mapOf("B" to mapOf("C" to "D", "E" to "F")))
|
||||
)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.Arrays
|
||||
|
||||
@Parcelize
|
||||
class Data(val data: Array<Array<Int>>) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Data(arrayOf(arrayOf(0, 1)))
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val second = readFromParcel<Data>(parcel)
|
||||
assert(second.data.size == 1)
|
||||
assert(Arrays.equals(second.data[0], arrayOf(0, 1)))
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.Arrays
|
||||
|
||||
@Parcelize
|
||||
class Data(val data: List<Array<Int>>) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Data(listOf(arrayOf(0, 1)))
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val second = readFromParcel<Data>(parcel)
|
||||
assert(second.data.size == 1)
|
||||
assert(Arrays.equals(second.data[0], arrayOf(0, 1)))
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.Arrays
|
||||
|
||||
@Parcelize
|
||||
class Data(val data: Map<Array<Int>, Array<Int>>) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Data(mapOf(arrayOf(0) to arrayOf(1)))
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val second = readFromParcel<Data>(parcel)
|
||||
assert(second.data.size == 1)
|
||||
val entry = second.data.entries.single()
|
||||
assert(Arrays.equals(entry.key, arrayOf(0)))
|
||||
assert(Arrays.equals(entry.value, arrayOf(1)))
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
// Starts with A, should be loaded before other classes
|
||||
abstract class AParcelable : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class P1(val a: String) : AParcelable()
|
||||
|
||||
sealed class Sealed : AParcelable()
|
||||
|
||||
@Parcelize
|
||||
data class Sealed1(val a: Int) : Sealed()
|
||||
|
||||
@Parcelize
|
||||
data class Test(val a: P1, val b: AParcelable, val c: Sealed, val d: Sealed1) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = Test(P1(""), P1("My"), Sealed1(1), Sealed1(5))
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<Test>(parcel)
|
||||
assert(test == test2)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.util.SparseArray
|
||||
import java.util.Arrays
|
||||
|
||||
@Parcelize
|
||||
class Data(val data: SparseArray<Array<Int>>) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
var array = SparseArray<Array<Int>>()
|
||||
array.append(0, arrayOf(0, 1))
|
||||
val first = Data(array)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val second = readFromParcel<Data>(parcel)
|
||||
assert(second.data.size() == 1)
|
||||
assert(Arrays.equals(second.data.get(0), arrayOf(0, 1)))
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class User(val firstName: String, val secondName: String, val age: Int) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val user = User("John", "Smith", 20)
|
||||
val user2 = User("Joe", "Bloggs", 30)
|
||||
val array = arrayOf(user, user2)
|
||||
parcel.writeTypedArray(array, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val creator = User::class.java.getDeclaredField("CREATOR").get(null) as Parcelable.Creator<User>
|
||||
val result = parcel.createTypedArray(creator)
|
||||
|
||||
assert(result.size == 2)
|
||||
assert(result[0].firstName == user.firstName)
|
||||
assert(result[1].firstName == user2.firstName)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Foo(val a: String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val str1: String,
|
||||
val str2: String?,
|
||||
val int1: Int,
|
||||
val int2: Int?,
|
||||
val foo: Foo?
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Test("John", "Smith", 20, 30, Foo("a"))
|
||||
val second = Test("A", null, 20, null, null)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
second.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<Test>(parcel)
|
||||
val second2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
assert(second == second2)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Test(val a: String?) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Test("John")
|
||||
val second = Test(null)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
second.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<Test>(parcel)
|
||||
val second2 = readFromParcel<Test>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
assert(second == second2)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
object Obj1 {
|
||||
object Obj2
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
data class Test(val o1: Obj1, val o2: Obj1.Obj2, val com: Com) : Parcelable {
|
||||
companion object Com {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = Test(Obj1, Obj1.Obj2, Test.Com)
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<Test>(parcel)
|
||||
assert(test == test2)
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
open class Base(val a: String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
class Inh(var b: Int) : Base(""), Parcelable
|
||||
|
||||
fun box(): String {
|
||||
Inh(0)
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// See KT-38104
|
||||
// The support for PersistableBundles is broken on JVM.
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.os.BaseBundle
|
||||
import android.os.PersistableBundle
|
||||
|
||||
@Parcelize
|
||||
data class User(val a: PersistableBundle) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = User(
|
||||
PersistableBundle().apply { putLong("A", 1L) }
|
||||
)
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<User>(parcel)
|
||||
|
||||
assert(compareBundles(test.a, test2.a))
|
||||
}
|
||||
|
||||
private fun compareBundles(first: BaseBundle, second: BaseBundle): Boolean {
|
||||
if (first.size() != second.size()) return false
|
||||
|
||||
for (key in first.keySet()) {
|
||||
if (first.get(key) != second.get(key)) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class PrimitiveTypes(
|
||||
val boo: Boolean,
|
||||
val c: Char,
|
||||
val byt: Byte,
|
||||
val s: Short,
|
||||
val i: Int,
|
||||
val f: Float,
|
||||
val l: Long,
|
||||
val d: Double
|
||||
) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = PrimitiveTypes(true, '#', 3.toByte(), 10.toShort(), -300, -5.0f, Long.MAX_VALUE, 3.14)
|
||||
val second = PrimitiveTypes(false, '\n', Byte.MIN_VALUE, Short.MIN_VALUE, Int.MIN_VALUE, Float.POSITIVE_INFINITY,
|
||||
Long.MAX_VALUE, Double.NEGATIVE_INFINITY)
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
second.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val first2 = readFromParcel<PrimitiveTypes>(parcel)
|
||||
val second2 = readFromParcel<PrimitiveTypes>(parcel)
|
||||
|
||||
assert(first == first2)
|
||||
assert(second == second2)
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
sealed class Foo : Parcelable {
|
||||
@Parcelize
|
||||
data class A(val x: Int) : Foo()
|
||||
|
||||
@Parcelize
|
||||
data class B (val x: String) : Foo()
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
data class Bar(val a: Foo) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val first = Bar(Foo.B("OK"))
|
||||
|
||||
first.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val second = readFromParcel<Bar>(parcel)
|
||||
|
||||
assert(first == second)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
annotation class SerializableLike
|
||||
|
||||
@Parcelize @SerializableLike
|
||||
data class User(val firstName: String, val secondName: String, val age: Int) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val user = User("John", "Smith", 20)
|
||||
user.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val user2 = readFromParcel<User>(parcel)
|
||||
assert(user == user2)
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.util.*
|
||||
|
||||
@Parcelize
|
||||
data class Data(val a: String, val b: String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class User(val a: SparseIntArray, val b: SparseLongArray, val c: SparseArray<Data>) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val user = User(
|
||||
a = SparseIntArray().apply { put(1, 5); put(100, -1); put(1000, 0) },
|
||||
b = SparseLongArray().apply { put(3, 2); put(2, 3); put(10, 10) },
|
||||
c = SparseArray<Data>().apply { put(1, Data("A", "B")); put(10, Data("C", "D")); put(105, Data("E", "")) }
|
||||
)
|
||||
|
||||
user.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val user2 = readFromParcel<User>(parcel)
|
||||
|
||||
assert(compareSparseIntArrays(user.a, user2.a))
|
||||
assert(compareSparseLongArrays(user.b, user2.b))
|
||||
assert(compareSparseArrays(user.c, user2.c))
|
||||
}
|
||||
|
||||
private fun compareSparseIntArrays(first: SparseIntArray, second: SparseIntArray): Boolean {
|
||||
if (first === second) return true
|
||||
if (first.size() != second.size()) return false
|
||||
|
||||
for (i in 0 until first.size()) {
|
||||
if (first.keyAt(i) != second.keyAt(i)) return false
|
||||
if (first.valueAt(i) != second.valueAt(i)) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun compareSparseLongArrays(first: SparseLongArray, second: SparseLongArray): Boolean {
|
||||
if (first === second) return true
|
||||
if (first.size() != second.size()) return false
|
||||
|
||||
for (i in 0 until first.size()) {
|
||||
if (first.keyAt(i) != second.keyAt(i)) return false
|
||||
if (first.valueAt(i) != second.valueAt(i)) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun compareSparseArrays(first: SparseArray<*>, second: SparseArray<*>): Boolean {
|
||||
if (first === second) return true
|
||||
if (first.size() != second.size()) return false
|
||||
|
||||
for (i in 0 until first.size()) {
|
||||
if (first.keyAt(i) != second.keyAt(i)) return false
|
||||
if (first.valueAt(i) != second.valueAt(i)) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:JvmName("TestKt")
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.util.SparseBooleanArray
|
||||
|
||||
@Parcelize
|
||||
data class User(val a: SparseBooleanArray) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
val test = User(SparseBooleanArray().apply { put(1, false); put(5, true); put(1000, false) })
|
||||
test.writeToParcel(parcel, 0)
|
||||
|
||||
val bytes = parcel.marshall()
|
||||
parcel.unmarshall(bytes, 0, bytes.size)
|
||||
parcel.setDataPosition(0)
|
||||
|
||||
val test2 = readFromParcel<User>(parcel)
|
||||
|
||||
assert(compareSparseBooleanArrays(test.a, test2.a))
|
||||
}
|
||||
|
||||
private fun compareSparseBooleanArrays(first: SparseBooleanArray, second: SparseBooleanArray): Boolean {
|
||||
if (first === second) return true
|
||||
if (first.size() != second.size()) return false
|
||||
|
||||
for (i in 0 until first.size()) {
|
||||
if (first.keyAt(i) != second.keyAt(i)) return false
|
||||
if (first.valueAt(i) != second.valueAt(i)) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package test
|
||||
|
||||
import android.os.Parcel
|
||||
|
||||
fun parcelTest(block: (Parcel) -> Unit): String {
|
||||
val parcel = Parcel.obtain()
|
||||
try {
|
||||
block(parcel)
|
||||
return "OK"
|
||||
} finally {
|
||||
parcel.recycle()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <reified T> readFromParcel(parcel: Parcel): T {
|
||||
val creator = T::class.java.getDeclaredField("CREATOR").get(null)
|
||||
return creator::class.java.getDeclaredMethod("createFromParcel", Parcel::class.java).invoke(creator, parcel) as T
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel parcel) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readStrongBinder, ()Landroid/os/IBinder;)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, createBinderArray, ()[Landroid/os/IBinder;)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, createBinderArrayList, ()Ljava/util/ArrayList;)
|
||||
CHECKCAST
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, createBinderArrayList, ()Ljava/util/ArrayList;)
|
||||
INVOKESPECIAL (User, <init>, (Landroid/os/IBinder;[Landroid/os/IBinder;Ljava/util/List;Ljava/util/ArrayList;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (User$Creator, createFromParcel, (Landroid/os/Parcel;)LUser;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final User[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final android.os.IBinder binder
|
||||
|
||||
private final android.os.IBinder[] binderArray
|
||||
|
||||
private final java.util.ArrayList binderArrayList
|
||||
|
||||
private final java.util.List binderList
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(android.os.IBinder binder, android.os.IBinder[] binderArray, java.util.List binderList, java.util.ArrayList binderArrayList)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final android.os.IBinder getBinder()
|
||||
|
||||
public final android.os.IBinder[] getBinderArray()
|
||||
|
||||
public final java.util.ArrayList getBinderArrayList()
|
||||
|
||||
public final java.util.List getBinderList()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (binder, Landroid/os/IBinder;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeStrongBinder, (Landroid/os/IBinder;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (binderArray, [Landroid/os/IBinder;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeBinderArray, ([Landroid/os/IBinder;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (binderList, Ljava/util/List;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeBinderList, (Ljava/util/List;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (binderArrayList, Ljava/util/ArrayList;)
|
||||
CHECKCAST
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeBinderList, (Ljava/util/List;)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// CURIOUS_ABOUT writeToParcel, createFromParcel
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcelable
|
||||
import android.os.IBinder
|
||||
import android.os.IInterface
|
||||
|
||||
@Parcelize
|
||||
class User(
|
||||
val binder: IBinder,
|
||||
val binderArray: Array<IBinder>,
|
||||
val binderList: List<IBinder>,
|
||||
val binderArrayList: ArrayList<IBinder> // should be serialized using our strategy, not using Parcel.writeBinderList()
|
||||
// There is no readStrongInterface method in Parcel.
|
||||
// val intf: IInterface?
|
||||
) : Parcelable
|
||||
@@ -0,0 +1,126 @@
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel in) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (in)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
LABEL (L1)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readStrongBinder, ()Landroid/os/IBinder;)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, createBinderArray, ()[Landroid/os/IBinder;)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, createBinderArrayList, ()Ljava/util/ArrayList;)
|
||||
CHECKCAST
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readInt, ()I)
|
||||
ISTORE (2)
|
||||
NEW
|
||||
DUP
|
||||
ILOAD (2)
|
||||
INVOKESPECIAL (java/util/ArrayList, <init>, (I)V)
|
||||
ILOAD (2)
|
||||
LABEL (L2)
|
||||
DUP_X1
|
||||
IFEQ (L3)
|
||||
DUP
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readStrongBinder, ()Landroid/os/IBinder;)
|
||||
INVOKEVIRTUAL (java/util/ArrayList, add, (Ljava/lang/Object;)Z)
|
||||
POP
|
||||
SWAP
|
||||
LDC (-1)
|
||||
IADD
|
||||
GOTO (L2)
|
||||
LABEL (L3)
|
||||
SWAP
|
||||
POP
|
||||
INVOKESPECIAL (User, <init>, (Landroid/os/IBinder;[Landroid/os/IBinder;Ljava/util/List;Ljava/util/ArrayList;)V)
|
||||
ARETURN
|
||||
LABEL (L4)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (10)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (User$Creator, createFromParcel, (Landroid/os/Parcel;)LUser;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public final User[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final android.os.IBinder binder
|
||||
|
||||
private final android.os.IBinder[] binderArray
|
||||
|
||||
private final java.util.ArrayList binderArrayList
|
||||
|
||||
private final java.util.List binderList
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(android.os.IBinder binder, android.os.IBinder[] binderArray, java.util.List binderList, java.util.ArrayList binderArrayList)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final android.os.IBinder getBinder()
|
||||
|
||||
public final android.os.IBinder[] getBinderArray()
|
||||
|
||||
public final java.util.ArrayList getBinderArrayList()
|
||||
|
||||
public final java.util.List getBinderList()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (binder, Landroid/os/IBinder;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeStrongBinder, (Landroid/os/IBinder;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (binderArray, [Landroid/os/IBinder;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeBinderArray, ([Landroid/os/IBinder;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (binderList, Ljava/util/List;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeBinderList, (Ljava/util/List;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (binderArrayList, Ljava/util/ArrayList;)
|
||||
DUP_X1
|
||||
INVOKEINTERFACE (java/util/Collection, size, ()I)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
INVOKEINTERFACE (java/util/Collection, iterator, ()Ljava/util/Iterator;)
|
||||
LABEL (L1)
|
||||
DUP
|
||||
INVOKEINTERFACE (java/util/Iterator, hasNext, ()Z)
|
||||
IFEQ (L2)
|
||||
DUP
|
||||
ALOAD (1)
|
||||
SWAP
|
||||
INVOKEINTERFACE (java/util/Iterator, next, ()Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeStrongBinder, (Landroid/os/IBinder;)V)
|
||||
GOTO (L1)
|
||||
LABEL (L2)
|
||||
POP
|
||||
RETURN
|
||||
LABEL (L3)
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel parcel)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source)
|
||||
|
||||
public final User[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final int age
|
||||
|
||||
private final java.lang.String firstName
|
||||
|
||||
private final boolean isProUser
|
||||
|
||||
private final java.lang.String lastName
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(java.lang.String firstName, java.lang.String lastName, int age, boolean isProUser)
|
||||
|
||||
public int describeContents() {
|
||||
LABEL (L0)
|
||||
LINENUMBER (9)
|
||||
BIPUSH (100)
|
||||
IRETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final int getAge()
|
||||
|
||||
public final java.lang.String getFirstName()
|
||||
|
||||
public final java.lang.String getLastName()
|
||||
|
||||
public final boolean isProUser()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// CURIOUS_ABOUT describeContents
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class User(val firstName: String, val lastName: String, val age: Int, val isProUser: Boolean) : Parcelable {
|
||||
override fun describeContents() = 100
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel in)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0)
|
||||
|
||||
public final User[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final int age
|
||||
|
||||
private final java.lang.String firstName
|
||||
|
||||
private final boolean isProUser
|
||||
|
||||
private final java.lang.String lastName
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(java.lang.String firstName, java.lang.String lastName, int age, boolean isProUser)
|
||||
|
||||
public int describeContents() {
|
||||
LABEL (L0)
|
||||
LINENUMBER (9)
|
||||
BIPUSH (100)
|
||||
IRETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final int getAge()
|
||||
|
||||
public final java.lang.String getFirstName()
|
||||
|
||||
public final java.lang.String getLastName()
|
||||
|
||||
public final boolean isProUser()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags)
|
||||
}
|
||||
Vendored
+69
@@ -0,0 +1,69 @@
|
||||
public final class test/Foo$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final test.Foo createFromParcel(android.os.Parcel parcel) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
LDC (Ltest/Foo;)
|
||||
INVOKEVIRTUAL (java/lang/Class, getClassLoader, ()Ljava/lang/ClassLoader;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readParcelable, (Ljava/lang/ClassLoader;)Landroid/os/Parcelable;)
|
||||
CHECKCAST
|
||||
INVOKESPECIAL (test/Foo, <init>, (Landroid/accounts/Account;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (test/Foo$Creator, createFromParcel, (Landroid/os/Parcel;)Ltest/Foo;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final test.Foo[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class test/Foo : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final android.accounts.Account kp
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (test/Foo$Creator, <init>, ()V)
|
||||
CHECKCAST
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(android.accounts.Account kp)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final android.accounts.Account getKp()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (kp, Landroid/accounts/Account;)
|
||||
CHECKCAST
|
||||
ILOAD (2)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeParcelable, (Landroid/os/Parcelable;I)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// CURIOUS_ABOUT writeToParcel, createFromParcel, <clinit>
|
||||
// WITH_RUNTIME
|
||||
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.*
|
||||
import android.accounts.Account
|
||||
|
||||
@Parcelize
|
||||
class Foo(val kp: Account): Parcelable
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
public final class test/Foo$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final test.Foo createFromParcel(android.os.Parcel in) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (in)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
LDC (Ltest/Foo;)
|
||||
INVOKEVIRTUAL (java/lang/Class, getClassLoader, ()Ljava/lang/ClassLoader;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readParcelable, (Ljava/lang/ClassLoader;)Landroid/os/Parcelable;)
|
||||
CHECKCAST
|
||||
INVOKESPECIAL (test/Foo, <init>, (Landroid/accounts/Account;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (11)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (test/Foo$Creator, createFromParcel, (Landroid/os/Parcel;)Ltest/Foo;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public final test.Foo[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class test/Foo : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final android.accounts.Account kp
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (test/Foo$Creator, <init>, ()V)
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(android.accounts.Account kp)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final android.accounts.Account getKp()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (kp, Landroid/accounts/Account;)
|
||||
ILOAD (2)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeParcelable, (Landroid/os/Parcelable;I)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
public final class k/KotlinParcelable$Companion : java/lang/Object {
|
||||
private void <init>()
|
||||
|
||||
public void <init>(kotlin.jvm.internal.DefaultConstructorMarker $constructor_marker)
|
||||
}
|
||||
|
||||
public final class k/KotlinParcelable$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public k.KotlinParcelable createFromParcel(android.os.Parcel source) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (source)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
LABEL (L1)
|
||||
LINENUMBER (23)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readInt, ()I)
|
||||
ISTORE (2)
|
||||
LABEL (L2)
|
||||
LINENUMBER (24)
|
||||
NEW
|
||||
DUP
|
||||
ILOAD (2)
|
||||
INVOKESPECIAL (k/KotlinParcelable, <init>, (I)V)
|
||||
ARETURN
|
||||
LABEL (L3)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (k/KotlinParcelable$Creator, createFromParcel, (Landroid/os/Parcel;)Lk/KotlinParcelable;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public k.KotlinParcelable[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class k/KotlinParcelable : java/lang/Object, android/os/Parcelable {
|
||||
public final static k.KotlinParcelable$Creator CREATOR
|
||||
|
||||
public final static k.KotlinParcelable$Companion Companion
|
||||
|
||||
private int data
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
ACONST_NULL
|
||||
INVOKESPECIAL (k/KotlinParcelable$Companion, <init>, (Lkotlin/jvm/internal/DefaultConstructorMarker;)V)
|
||||
PUTSTATIC (Companion, Lk/KotlinParcelable$Companion;)
|
||||
LABEL (L0)
|
||||
LINENUMBER (18)
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (k/KotlinParcelable$Creator, <init>, ()V)
|
||||
PUTSTATIC (CREATOR, Lk/KotlinParcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(int data)
|
||||
|
||||
public final int component1()
|
||||
|
||||
public final k.KotlinParcelable copy(int data)
|
||||
|
||||
public static k.KotlinParcelable copy$default(k.KotlinParcelable p0, int p1, int p2, java.lang.Object p3)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public boolean equals(java.lang.Object other)
|
||||
|
||||
public final int getData()
|
||||
|
||||
public int hashCode()
|
||||
|
||||
public final void setData(int <set-?>)
|
||||
|
||||
public java.lang.String toString()
|
||||
|
||||
public void writeToParcel(android.os.Parcel dest, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (dest)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
LABEL (L1)
|
||||
LINENUMBER (13)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (data, I)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
LABEL (L2)
|
||||
LINENUMBER (14)
|
||||
RETURN
|
||||
LABEL (L3)
|
||||
}
|
||||
}
|
||||
|
||||
public final class test/Foo$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final test.Foo createFromParcel(android.os.Parcel parcel) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
GETSTATIC (CREATOR, Lk/KotlinParcelable$Creator;)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (k/KotlinParcelable$Creator, createFromParcel, (Landroid/os/Parcel;)Lk/KotlinParcelable;)
|
||||
INVOKESPECIAL (test/Foo, <init>, (Lk/KotlinParcelable;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (test/Foo$Creator, createFromParcel, (Landroid/os/Parcel;)Ltest/Foo;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final test.Foo[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class test/Foo : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final k.KotlinParcelable kp
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (test/Foo$Creator, <init>, ()V)
|
||||
CHECKCAST
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(k.KotlinParcelable kp)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final k.KotlinParcelable getKp()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (0)
|
||||
GETFIELD (kp, Lk/KotlinParcelable;)
|
||||
ALOAD (1)
|
||||
ILOAD (2)
|
||||
INVOKEVIRTUAL (k/KotlinParcelable, writeToParcel, (Landroid/os/Parcel;I)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// CURIOUS_ABOUT writeToParcel, createFromParcel, <clinit>
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: KotlinParcelable.kt
|
||||
package k
|
||||
import android.os.*
|
||||
|
||||
data class KotlinParcelable(var data: Int): Parcelable {
|
||||
|
||||
override fun describeContents() = 1
|
||||
|
||||
override fun writeToParcel(dest: Parcel, flags: Int) {
|
||||
dest.writeInt(data)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val CREATOR = Creator()
|
||||
}
|
||||
|
||||
class Creator : Parcelable.Creator<KotlinParcelable> {
|
||||
override fun createFromParcel(source: Parcel): KotlinParcelable {
|
||||
val data = source.readInt()
|
||||
return KotlinParcelable(data)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int) = arrayOfNulls<KotlinParcelable>(size)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FILE: test.kt
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.*
|
||||
import k.*
|
||||
|
||||
@Parcelize
|
||||
class Foo(val kp: KotlinParcelable): Parcelable
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
public final class k/KotlinParcelable$Companion : java/lang/Object {
|
||||
private void <init>()
|
||||
|
||||
public void <init>(kotlin.jvm.internal.DefaultConstructorMarker $constructor_marker)
|
||||
}
|
||||
|
||||
public final class k/KotlinParcelable$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public k.KotlinParcelable createFromParcel(android.os.Parcel source) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (source)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
LABEL (L1)
|
||||
LINENUMBER (23)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readInt, ()I)
|
||||
ISTORE (2)
|
||||
LABEL (L2)
|
||||
LINENUMBER (24)
|
||||
NEW
|
||||
DUP
|
||||
ILOAD (2)
|
||||
INVOKESPECIAL (k/KotlinParcelable, <init>, (I)V)
|
||||
ARETURN
|
||||
LABEL (L3)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (21)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (k/KotlinParcelable$Creator, createFromParcel, (Landroid/os/Parcel;)Lk/KotlinParcelable;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public k.KotlinParcelable[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class k/KotlinParcelable : java/lang/Object, android/os/Parcelable {
|
||||
public final static k.KotlinParcelable$Creator CREATOR
|
||||
|
||||
public final static k.KotlinParcelable$Companion Companion
|
||||
|
||||
private int data
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
ACONST_NULL
|
||||
INVOKESPECIAL (k/KotlinParcelable$Companion, <init>, (Lkotlin/jvm/internal/DefaultConstructorMarker;)V)
|
||||
PUTSTATIC (Companion, Lk/KotlinParcelable$Companion;)
|
||||
LABEL (L0)
|
||||
LINENUMBER (18)
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (k/KotlinParcelable$Creator, <init>, ()V)
|
||||
PUTSTATIC (CREATOR, Lk/KotlinParcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(int data)
|
||||
|
||||
public final int component1()
|
||||
|
||||
public final k.KotlinParcelable copy(int data)
|
||||
|
||||
public static k.KotlinParcelable copy$default(k.KotlinParcelable p0, int p1, int p2, java.lang.Object p3)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public boolean equals(java.lang.Object p0)
|
||||
|
||||
public final int getData()
|
||||
|
||||
public int hashCode()
|
||||
|
||||
public final void setData(int <set-?>)
|
||||
|
||||
public java.lang.String toString()
|
||||
|
||||
public void writeToParcel(android.os.Parcel dest, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (dest)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
LABEL (L1)
|
||||
LINENUMBER (13)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (data, I)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
LABEL (L2)
|
||||
LINENUMBER (14)
|
||||
RETURN
|
||||
LABEL (L3)
|
||||
}
|
||||
}
|
||||
|
||||
public final class test/Foo$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final test.Foo createFromParcel(android.os.Parcel in) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (in)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
LDC (Ltest/Foo;)
|
||||
INVOKEVIRTUAL (java/lang/Class, getClassLoader, ()Ljava/lang/ClassLoader;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readParcelable, (Ljava/lang/ClassLoader;)Landroid/os/Parcelable;)
|
||||
CHECKCAST
|
||||
INVOKESPECIAL (test/Foo, <init>, (Lk/KotlinParcelable;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (9)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (test/Foo$Creator, createFromParcel, (Landroid/os/Parcel;)Ltest/Foo;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public final test.Foo[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class test/Foo : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final k.KotlinParcelable kp
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (test/Foo$Creator, <init>, ()V)
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(k.KotlinParcelable kp)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final k.KotlinParcelable getKp()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (kp, Lk/KotlinParcelable;)
|
||||
ILOAD (2)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeParcelable, (Landroid/os/Parcelable;I)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
final class User$Companion : java/lang/Object, kotlinx/parcelize/Parceler {
|
||||
private void <init>()
|
||||
|
||||
public void <init>(kotlin.jvm.internal.DefaultConstructorMarker $constructor_marker)
|
||||
|
||||
public User create(android.os.Parcel parcel)
|
||||
|
||||
public java.lang.Object create(android.os.Parcel parcel)
|
||||
|
||||
public User[] newArray(int size) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (10)
|
||||
ALOAD (0)
|
||||
ILOAD (1)
|
||||
INVOKESTATIC (kotlinx/parcelize/Parceler$DefaultImpls, newArray, (Lkotlinx/parcelize/Parceler;I)[Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object[] newArray(int size) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ILOAD (1)
|
||||
INVOKEVIRTUAL (User$Companion, newArray, (I)[LUser;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public void write(User $this$write, android.os.Parcel parcel, int flags)
|
||||
|
||||
public void write(java.lang.Object $this$write, android.os.Parcel parcel, int flags)
|
||||
}
|
||||
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel parcel) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
INVOKESTATIC (User, access$getCompanion$p$s2645995, ()LUser$Companion;)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (User$Companion, create, (Landroid/os/Parcel;)LUser;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (User$Creator, createFromParcel, (Landroid/os/Parcel;)LUser;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final User[] newArray(int size) {
|
||||
LABEL (L0)
|
||||
ILOAD (1)
|
||||
ANEWARRAY
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object[] newArray(int size) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ILOAD (1)
|
||||
INVOKEVIRTUAL (User$Creator, newArray, (I)[LUser;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final static User$Companion Companion
|
||||
|
||||
private final int age
|
||||
|
||||
private final java.lang.String firstName
|
||||
|
||||
private final java.lang.String lastName
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(java.lang.String firstName, java.lang.String lastName, int age)
|
||||
|
||||
public final static User$Companion access$getCompanion$p$s2645995()
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final int getAge()
|
||||
|
||||
public final java.lang.String getFirstName()
|
||||
|
||||
public final java.lang.String getLastName()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
GETSTATIC (Companion, LUser$Companion;)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
ILOAD (2)
|
||||
INVOKEVIRTUAL (User$Companion, write, (LUser;Landroid/os/Parcel;I)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// CURIOUS_ABOUT writeToParcel, createFromParcel, newArray
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class User(val firstName: String, val lastName: String, val age: Int) : Parcelable {
|
||||
private companion object : Parceler<User> {
|
||||
override fun User.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeString(lastName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel) = User(parcel.readString(), parcel.readString(), parcel.readInt())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
final class User$Companion : java/lang/Object, kotlinx/parcelize/Parceler {
|
||||
private void <init>()
|
||||
|
||||
public void <init>(kotlin.jvm.internal.DefaultConstructorMarker $constructor_marker)
|
||||
|
||||
public User create(android.os.Parcel parcel)
|
||||
|
||||
public java.lang.Object create(android.os.Parcel p0)
|
||||
|
||||
public User[] newArray(int size) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (10)
|
||||
ALOAD (0)
|
||||
ILOAD (1)
|
||||
INVOKESTATIC (kotlinx/parcelize/Parceler$DefaultImpls, newArray, (Lkotlinx/parcelize/Parceler;I)[Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object[] newArray(int p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (10)
|
||||
ALOAD (0)
|
||||
ILOAD (1)
|
||||
INVOKEVIRTUAL (User$Companion, newArray, (I)[LUser;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public void write(User $this$write, android.os.Parcel parcel, int flags)
|
||||
|
||||
public void write(java.lang.Object p0, android.os.Parcel p1, int p2)
|
||||
}
|
||||
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel in) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (in)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
GETSTATIC (Companion, LUser$Companion;)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (User$Companion, create, (Landroid/os/Parcel;)LUser;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (9)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (User$Creator, createFromParcel, (Landroid/os/Parcel;)LUser;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public final User[] newArray(int size) {
|
||||
LABEL (L0)
|
||||
ILOAD (1)
|
||||
ANEWARRAY
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object[] newArray(int p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (9)
|
||||
ALOAD (0)
|
||||
ILOAD (1)
|
||||
INVOKEVIRTUAL (User$Creator, newArray, (I)[LUser;)
|
||||
ARETURN
|
||||
}
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final static User$Companion Companion
|
||||
|
||||
private final int age
|
||||
|
||||
private final java.lang.String firstName
|
||||
|
||||
private final java.lang.String lastName
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(java.lang.String firstName, java.lang.String lastName, int age)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final int getAge()
|
||||
|
||||
public final java.lang.String getFirstName()
|
||||
|
||||
public final java.lang.String getLastName()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
GETSTATIC (Companion, LUser$Companion;)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
ILOAD (2)
|
||||
INVOKEVIRTUAL (User$Companion, write, (LUser;Landroid/os/Parcel;I)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
final class User$Companion : java/lang/Object, kotlinx/parcelize/Parceler {
|
||||
private void <init>()
|
||||
|
||||
public void <init>(kotlin.jvm.internal.DefaultConstructorMarker $constructor_marker)
|
||||
|
||||
public User create(android.os.Parcel parcel)
|
||||
|
||||
public java.lang.Object create(android.os.Parcel parcel)
|
||||
|
||||
public User[] newArray(int size) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (19)
|
||||
ILOAD (1)
|
||||
ANEWARRAY
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object[] newArray(int size) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ILOAD (1)
|
||||
INVOKEVIRTUAL (User$Companion, newArray, (I)[LUser;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public void write(User $this$write, android.os.Parcel parcel, int flags)
|
||||
|
||||
public void write(java.lang.Object $this$write, android.os.Parcel parcel, int flags)
|
||||
}
|
||||
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel parcel)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source)
|
||||
|
||||
public final User[] newArray(int size) {
|
||||
LABEL (L0)
|
||||
INVOKESTATIC (User, access$getCompanion$p$s2645995, ()LUser$Companion;)
|
||||
ILOAD (1)
|
||||
INVOKEVIRTUAL (User$Companion, newArray, (I)[LUser;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object[] newArray(int size) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ILOAD (1)
|
||||
INVOKEVIRTUAL (User$Creator, newArray, (I)[LUser;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final static User$Companion Companion
|
||||
|
||||
private final int age
|
||||
|
||||
private final java.lang.String firstName
|
||||
|
||||
private final java.lang.String lastName
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(java.lang.String firstName, java.lang.String lastName, int age)
|
||||
|
||||
public final static User$Companion access$getCompanion$p$s2645995()
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final int getAge()
|
||||
|
||||
public final java.lang.String getFirstName()
|
||||
|
||||
public final java.lang.String getLastName()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags)
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// CURIOUS_ABOUT newArray
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class User(val firstName: String, val lastName: String, val age: Int) : Parcelable {
|
||||
private companion object : Parceler<User> {
|
||||
override fun User.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(firstName)
|
||||
parcel.writeString(lastName)
|
||||
parcel.writeInt(age)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel) = User(parcel.readString(), parcel.readString(), parcel.readInt())
|
||||
|
||||
override fun newArray(size: Int) = arrayOfNulls<User>(size) as Array<User>
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
final class User$Companion : java/lang/Object, kotlinx/parcelize/Parceler {
|
||||
private void <init>()
|
||||
|
||||
public void <init>(kotlin.jvm.internal.DefaultConstructorMarker $constructor_marker)
|
||||
|
||||
public User create(android.os.Parcel parcel)
|
||||
|
||||
public java.lang.Object create(android.os.Parcel p0)
|
||||
|
||||
public User[] newArray(int size) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (19)
|
||||
ILOAD (1)
|
||||
ANEWARRAY
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object[] newArray(int p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (10)
|
||||
ALOAD (0)
|
||||
ILOAD (1)
|
||||
INVOKEVIRTUAL (User$Companion, newArray, (I)[LUser;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public void write(User $this$write, android.os.Parcel parcel, int flags)
|
||||
|
||||
public void write(java.lang.Object p0, android.os.Parcel p1, int p2)
|
||||
}
|
||||
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel in)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0)
|
||||
|
||||
public final User[] newArray(int size) {
|
||||
LABEL (L0)
|
||||
GETSTATIC (Companion, LUser$Companion;)
|
||||
ILOAD (1)
|
||||
INVOKEVIRTUAL (User$Companion, newArray, (I)[LUser;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object[] newArray(int p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (9)
|
||||
ALOAD (0)
|
||||
ILOAD (1)
|
||||
INVOKEVIRTUAL (User$Creator, newArray, (I)[LUser;)
|
||||
ARETURN
|
||||
}
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final static User$Companion Companion
|
||||
|
||||
private final int age
|
||||
|
||||
private final java.lang.String firstName
|
||||
|
||||
private final java.lang.String lastName
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(java.lang.String firstName, java.lang.String lastName, int age)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final int getAge()
|
||||
|
||||
public final java.lang.String getFirstName()
|
||||
|
||||
public final java.lang.String getLastName()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags)
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
public abstract class AbstractUser : java/lang/Object, android/os/Parcelable {
|
||||
public void <init>()
|
||||
|
||||
public int describeContents() {
|
||||
LABEL (L0)
|
||||
LINENUMBER (8)
|
||||
BIPUSH (100)
|
||||
IRETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel parcel)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source)
|
||||
|
||||
public final User[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class User : AbstractUser {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final int age
|
||||
|
||||
private final java.lang.String firstName
|
||||
|
||||
private final boolean isProUser
|
||||
|
||||
private final java.lang.String lastName
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(java.lang.String firstName, java.lang.String lastName, int age, boolean isProUser)
|
||||
|
||||
public final int getAge()
|
||||
|
||||
public final java.lang.String getFirstName()
|
||||
|
||||
public final java.lang.String getLastName()
|
||||
|
||||
public final boolean isProUser()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags)
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// CURIOUS_ABOUT describeContents
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcelable
|
||||
|
||||
abstract class AbstractUser : Parcelable {
|
||||
override fun describeContents() = 100
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class User(val firstName: String, val lastName: String, val age: Int, val isProUser: Boolean) : AbstractUser()
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
public abstract class AbstractUser : java/lang/Object, android/os/Parcelable {
|
||||
public void <init>()
|
||||
|
||||
public int describeContents() {
|
||||
LABEL (L0)
|
||||
LINENUMBER (8)
|
||||
BIPUSH (100)
|
||||
IRETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel in)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0)
|
||||
|
||||
public final User[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class User : AbstractUser {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final int age
|
||||
|
||||
private final java.lang.String firstName
|
||||
|
||||
private final boolean isProUser
|
||||
|
||||
private final java.lang.String lastName
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(java.lang.String firstName, java.lang.String lastName, int age, boolean isProUser)
|
||||
|
||||
public final int getAge()
|
||||
|
||||
public final java.lang.String getFirstName()
|
||||
|
||||
public final java.lang.String getLastName()
|
||||
|
||||
public final boolean isProUser()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags)
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
public final class User$Companion : java/lang/Object {
|
||||
private void <init>()
|
||||
|
||||
public void <init>(kotlin.jvm.internal.DefaultConstructorMarker $constructor_marker)
|
||||
|
||||
private static void getTest$annotations()
|
||||
}
|
||||
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel parcel)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source)
|
||||
|
||||
public final User[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
public final static User$Companion Companion
|
||||
|
||||
private final java.lang.String firstName
|
||||
|
||||
private final static java.lang.StringBuilder test
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
ACONST_NULL
|
||||
INVOKESPECIAL (User$Companion, <init>, (Lkotlin/jvm/internal/DefaultConstructorMarker;)V)
|
||||
PUTSTATIC (Companion, LUser$Companion;)
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (User$Creator, <init>, ()V)
|
||||
CHECKCAST
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
LABEL (L0)
|
||||
LINENUMBER (12)
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (java/lang/StringBuilder, <init>, ()V)
|
||||
PUTSTATIC (test, Ljava/lang/StringBuilder;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(java.lang.String firstName)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final java.lang.String getFirstName()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// CURIOUS_ABOUT <clinit>
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcelable
|
||||
import kotlin.jvm.JvmStatic
|
||||
|
||||
@Parcelize
|
||||
class User(val firstName: String) : Parcelable {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
private val test = StringBuilder()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
public final class User$Companion : java/lang/Object {
|
||||
private void <init>()
|
||||
|
||||
public void <init>(kotlin.jvm.internal.DefaultConstructorMarker $constructor_marker)
|
||||
|
||||
private static void getTest$annotations()
|
||||
}
|
||||
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel in)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0)
|
||||
|
||||
public final User[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
public final static User$Companion Companion
|
||||
|
||||
private final java.lang.String firstName
|
||||
|
||||
private final static java.lang.StringBuilder test
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
ACONST_NULL
|
||||
INVOKESPECIAL (User$Companion, <init>, (Lkotlin/jvm/internal/DefaultConstructorMarker;)V)
|
||||
PUTSTATIC (Companion, LUser$Companion;)
|
||||
LABEL (L0)
|
||||
LINENUMBER (12)
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (java/lang/StringBuilder, <init>, ()V)
|
||||
PUTSTATIC (test, Ljava/lang/StringBuilder;)
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (User$Creator, <init>, ()V)
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(java.lang.String firstName)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final java.lang.String getFirstName()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags)
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
public final class test/Bar$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final test.Bar createFromParcel(android.os.Parcel parcel) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
LABEL (L1)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readInt, ()I)
|
||||
IFNE (L2)
|
||||
ACONST_NULL
|
||||
GOTO (L3)
|
||||
LABEL (L2)
|
||||
GETSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
ALOAD (1)
|
||||
INVOKEINTERFACE (android/os/Parcelable$Creator, createFromParcel, (Landroid/os/Parcel;)Ljava/lang/Object;)
|
||||
LABEL (L3)
|
||||
CHECKCAST
|
||||
INVOKESPECIAL (test/Bar, <init>, (Ltest/Foo;)V)
|
||||
ARETURN
|
||||
LABEL (L4)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (test/Bar$Creator, createFromParcel, (Landroid/os/Parcel;)Ltest/Bar;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final test.Bar[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class test/Bar : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final test.Foo foo
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (test/Bar$Creator, <init>, ()V)
|
||||
CHECKCAST
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(test.Foo foo)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final test.Foo getFoo()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (0)
|
||||
GETFIELD (foo, Ltest/Foo;)
|
||||
ASTORE (3)
|
||||
ALOAD (3)
|
||||
IFNONNULL (L1)
|
||||
ALOAD (1)
|
||||
ICONST_0
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
GOTO (L2)
|
||||
LABEL (L1)
|
||||
ALOAD (1)
|
||||
ICONST_1
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
ALOAD (3)
|
||||
ALOAD (1)
|
||||
ILOAD (2)
|
||||
INVOKEVIRTUAL (test/Foo, writeToParcel, (Landroid/os/Parcel;I)V)
|
||||
LABEL (L2)
|
||||
RETURN
|
||||
LABEL (L3)
|
||||
}
|
||||
}
|
||||
|
||||
public final class test/Foo$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final test.Foo createFromParcel(android.os.Parcel parcel) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
GETSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
ALOAD (1)
|
||||
INVOKEINTERFACE (android/os/Parcelable$Creator, createFromParcel, (Landroid/os/Parcel;)Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
INVOKESPECIAL (test/Foo, <init>, (Ltest/Bar;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (test/Foo$Creator, createFromParcel, (Landroid/os/Parcel;)Ltest/Foo;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final test.Foo[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class test/Foo : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final test.Bar bar
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (test/Foo$Creator, <init>, ()V)
|
||||
CHECKCAST
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(test.Bar bar)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final test.Bar getBar()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (0)
|
||||
GETFIELD (bar, Ltest/Bar;)
|
||||
ALOAD (1)
|
||||
ILOAD (2)
|
||||
INVOKEVIRTUAL (test/Bar, writeToParcel, (Landroid/os/Parcel;I)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// CURIOUS_ABOUT writeToParcel, createFromParcel, <clinit>
|
||||
// WITH_RUNTIME
|
||||
//FILE: test.kt
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class Foo(val bar: Bar): Parcelable
|
||||
|
||||
@Parcelize
|
||||
class Bar(val foo: Foo?) : Parcelable
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
public final class test/Bar$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final test.Bar createFromParcel(android.os.Parcel in) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (in)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
LABEL (L1)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readInt, ()I)
|
||||
IFEQ (L2)
|
||||
ALOAD (1)
|
||||
GETSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
SWAP
|
||||
INVOKEINTERFACE (android/os/Parcelable$Creator, createFromParcel, (Landroid/os/Parcel;)Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
GOTO (L3)
|
||||
LABEL (L2)
|
||||
ACONST_NULL
|
||||
LABEL (L3)
|
||||
INVOKESPECIAL (test/Bar, <init>, (Ltest/Foo;)V)
|
||||
ARETURN
|
||||
LABEL (L4)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (13)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (test/Bar$Creator, createFromParcel, (Landroid/os/Parcel;)Ltest/Bar;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public final test.Bar[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class test/Bar : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final test.Foo foo
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (test/Bar$Creator, <init>, ()V)
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(test.Foo foo)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final test.Foo getFoo()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (foo, Ltest/Foo;)
|
||||
DUP
|
||||
IFNULL (L1)
|
||||
ALOAD (1)
|
||||
LDC (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
SWAP
|
||||
LDC (0)
|
||||
INVOKEINTERFACE (android/os/Parcelable, writeToParcel, (Landroid/os/Parcel;I)V)
|
||||
GOTO (L2)
|
||||
LABEL (L1)
|
||||
POP
|
||||
LDC (0)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
LABEL (L2)
|
||||
RETURN
|
||||
LABEL (L3)
|
||||
}
|
||||
}
|
||||
|
||||
public final class test/Foo$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final test.Foo createFromParcel(android.os.Parcel in) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (in)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
GETSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
SWAP
|
||||
INVOKEINTERFACE (android/os/Parcelable$Creator, createFromParcel, (Landroid/os/Parcel;)Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
INVOKESPECIAL (test/Foo, <init>, (Ltest/Bar;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (10)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (test/Foo$Creator, createFromParcel, (Landroid/os/Parcel;)Ltest/Foo;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public final test.Foo[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class test/Foo : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final test.Bar bar
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (test/Foo$Creator, <init>, ()V)
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(test.Bar bar)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final test.Bar getBar()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (bar, Ltest/Bar;)
|
||||
SWAP
|
||||
LDC (0)
|
||||
INVOKEINTERFACE (android/os/Parcelable, writeToParcel, (Landroid/os/Parcel;I)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
public final class test/SomeClass$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final test.SomeClass createFromParcel(android.os.Parcel parcel) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readInt, ()I)
|
||||
POP
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (test/SomeClass, <init>, ()V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (test/SomeClass$Creator, createFromParcel, (Landroid/os/Parcel;)Ltest/SomeClass;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final test.SomeClass[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class test/SomeClass : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>()
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ICONST_1
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// CURIOUS_ABOUT writeToParcel, createFromParcel
|
||||
// WITH_RUNTIME
|
||||
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class SomeClass : Parcelable
|
||||
@@ -0,0 +1,71 @@
|
||||
public final class test/SomeClass$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final test.SomeClass createFromParcel(android.os.Parcel in) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (in)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
LABEL (L1)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readInt, ()I)
|
||||
IFEQ (L2)
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (test/SomeClass, <init>, ()V)
|
||||
GOTO (L3)
|
||||
LABEL (L2)
|
||||
ACONST_NULL
|
||||
LABEL (L3)
|
||||
ARETURN
|
||||
LABEL (L4)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (10)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (test/SomeClass$Creator, createFromParcel, (Landroid/os/Parcel;)Ltest/SomeClass;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public final test.SomeClass[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class test/SomeClass : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>()
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
DUP
|
||||
IFNULL (L1)
|
||||
ALOAD (1)
|
||||
LDC (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
POP2
|
||||
GOTO (L2)
|
||||
LABEL (L1)
|
||||
POP
|
||||
LDC (0)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
LABEL (L2)
|
||||
RETURN
|
||||
LABEL (L3)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
public final class Test$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final Test createFromParcel(android.os.Parcel parcel)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source)
|
||||
|
||||
public final Test[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class Test : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final java.util.List names
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(java.util.List names)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final java.util.List getNames()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (0)
|
||||
GETFIELD (names, Ljava/util/List;)
|
||||
ASTORE (3)
|
||||
ALOAD (1)
|
||||
ALOAD (3)
|
||||
INVOKEINTERFACE (java/util/List, size, ()I)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
ALOAD (3)
|
||||
INVOKEINTERFACE (java/util/List, iterator, ()Ljava/util/Iterator;)
|
||||
ASTORE (4)
|
||||
LABEL (L1)
|
||||
ALOAD (4)
|
||||
INVOKEINTERFACE (java/util/Iterator, hasNext, ()Z)
|
||||
IFEQ (L2)
|
||||
ALOAD (4)
|
||||
INVOKEINTERFACE (java/util/Iterator, next, ()Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
ASTORE (5)
|
||||
ALOAD (1)
|
||||
ALOAD (5)
|
||||
INVOKEINTERFACE (java/util/List, size, ()I)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
ALOAD (5)
|
||||
INVOKEINTERFACE (java/util/List, iterator, ()Ljava/util/Iterator;)
|
||||
ASTORE (6)
|
||||
LABEL (L3)
|
||||
ALOAD (6)
|
||||
INVOKEINTERFACE (java/util/Iterator, hasNext, ()Z)
|
||||
IFEQ (L1)
|
||||
ALOAD (1)
|
||||
ALOAD (6)
|
||||
INVOKEINTERFACE (java/util/Iterator, next, ()Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeStringList, (Ljava/util/List;)V)
|
||||
GOTO (L3)
|
||||
LABEL (L2)
|
||||
RETURN
|
||||
LABEL (L4)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// CURIOUS_ABOUT writeToParcel
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class Test(val names: List<List<ArrayList<String>>>): Parcelable
|
||||
@@ -0,0 +1,86 @@
|
||||
public final class Test$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final Test createFromParcel(android.os.Parcel in)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0)
|
||||
|
||||
public final Test[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class Test : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final java.util.List names
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(java.util.List names)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final java.util.List getNames()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (names, Ljava/util/List;)
|
||||
DUP_X1
|
||||
INVOKEINTERFACE (java/util/Collection, size, ()I)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
INVOKEINTERFACE (java/util/Collection, iterator, ()Ljava/util/Iterator;)
|
||||
LABEL (L1)
|
||||
DUP
|
||||
INVOKEINTERFACE (java/util/Iterator, hasNext, ()Z)
|
||||
IFEQ (L2)
|
||||
DUP
|
||||
ALOAD (1)
|
||||
SWAP
|
||||
INVOKEINTERFACE (java/util/Iterator, next, ()Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
DUP_X1
|
||||
INVOKEINTERFACE (java/util/Collection, size, ()I)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
INVOKEINTERFACE (java/util/Collection, iterator, ()Ljava/util/Iterator;)
|
||||
LABEL (L3)
|
||||
DUP
|
||||
INVOKEINTERFACE (java/util/Iterator, hasNext, ()Z)
|
||||
IFEQ (L4)
|
||||
DUP
|
||||
ALOAD (1)
|
||||
SWAP
|
||||
INVOKEINTERFACE (java/util/Iterator, next, ()Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
DUP_X1
|
||||
INVOKEINTERFACE (java/util/Collection, size, ()I)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
INVOKEINTERFACE (java/util/Collection, iterator, ()Ljava/util/Iterator;)
|
||||
LABEL (L5)
|
||||
DUP
|
||||
INVOKEINTERFACE (java/util/Iterator, hasNext, ()Z)
|
||||
IFEQ (L6)
|
||||
DUP
|
||||
ALOAD (1)
|
||||
SWAP
|
||||
INVOKEINTERFACE (java/util/Iterator, next, ()Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeString, (Ljava/lang/String;)V)
|
||||
GOTO (L5)
|
||||
LABEL (L6)
|
||||
POP
|
||||
GOTO (L3)
|
||||
LABEL (L4)
|
||||
POP
|
||||
GOTO (L1)
|
||||
LABEL (L2)
|
||||
POP
|
||||
RETURN
|
||||
LABEL (L7)
|
||||
}
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
public final class TestNotNull$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final TestNotNull createFromParcel(android.os.Parcel parcel)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source)
|
||||
|
||||
public final TestNotNull[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class TestNotNull : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final android.util.Size a
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(android.util.Size a)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final android.util.Size getA()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (a, Landroid/util/Size;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeSize, (Landroid/util/Size;)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
|
||||
public final class TestNullable$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final TestNullable createFromParcel(android.os.Parcel parcel)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source)
|
||||
|
||||
public final TestNullable[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class TestNullable : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final android.util.Size a
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(android.util.Size a)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final android.util.Size getA()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (0)
|
||||
GETFIELD (a, Landroid/util/Size;)
|
||||
ASTORE (3)
|
||||
ALOAD (3)
|
||||
IFNONNULL (L1)
|
||||
ALOAD (1)
|
||||
ICONST_0
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
GOTO (L2)
|
||||
LABEL (L1)
|
||||
ALOAD (1)
|
||||
ICONST_1
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
ALOAD (1)
|
||||
ALOAD (3)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeSize, (Landroid/util/Size;)V)
|
||||
LABEL (L2)
|
||||
RETURN
|
||||
LABEL (L3)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// CURIOUS_ABOUT writeToParcel
|
||||
// WITH_RUNTIME
|
||||
|
||||
import android.util.Size
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class TestNullable(val a: Size?): Parcelable
|
||||
|
||||
@Parcelize
|
||||
class TestNotNull(val a: Size): Parcelable
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
public final class TestNotNull$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final TestNotNull createFromParcel(android.os.Parcel in)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0)
|
||||
|
||||
public final TestNotNull[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class TestNotNull : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final android.util.Size a
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(android.util.Size a)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final android.util.Size getA()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (a, Landroid/util/Size;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeSize, (Landroid/util/Size;)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
|
||||
public final class TestNullable$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final TestNullable createFromParcel(android.os.Parcel in)
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0)
|
||||
|
||||
public final TestNullable[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class TestNullable : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final android.util.Size a
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
public void <init>(android.util.Size a)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final android.util.Size getA()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (a, Landroid/util/Size;)
|
||||
DUP
|
||||
IFNULL (L1)
|
||||
ALOAD (1)
|
||||
LDC (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeSize, (Landroid/util/Size;)V)
|
||||
GOTO (L2)
|
||||
LABEL (L1)
|
||||
POP
|
||||
LDC (0)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
LABEL (L2)
|
||||
RETURN
|
||||
LABEL (L3)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
public final class test/Foo$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final test.Foo createFromParcel(android.os.Parcel parcel) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
LDC (Ltest/Foo;)
|
||||
INVOKEVIRTUAL (java/lang/Class, getClassLoader, ()Ljava/lang/ClassLoader;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readParcelable, (Ljava/lang/ClassLoader;)Landroid/os/Parcelable;)
|
||||
INVOKESPECIAL (test/Foo, <init>, (Landroid/os/Parcelable;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (test/Foo$Creator, createFromParcel, (Landroid/os/Parcel;)Ltest/Foo;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final test.Foo[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class test/Foo : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final android.os.Parcelable parcelable
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (test/Foo$Creator, <init>, ()V)
|
||||
CHECKCAST
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(android.os.Parcelable parcelable)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final android.os.Parcelable getParcelable()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (parcelable, Landroid/os/Parcelable;)
|
||||
ILOAD (2)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeParcelable, (Landroid/os/Parcelable;I)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// CURIOUS_ABOUT writeToParcel, createFromParcel, <clinit>
|
||||
// WITH_RUNTIME
|
||||
|
||||
//FILE: test/JavaClass.java
|
||||
package test;
|
||||
|
||||
class JavaClass {
|
||||
void test() {
|
||||
// Here we test access to CREATOR
|
||||
Object o = Foo.CREATOR;
|
||||
}
|
||||
}
|
||||
|
||||
//FILE: android/os/Parcel.java
|
||||
package android.os;
|
||||
|
||||
public class Parcel {}
|
||||
|
||||
//FILE: android/os/Parcelable.java
|
||||
package android.os;
|
||||
|
||||
public interface Parcelable {
|
||||
public static interface Creator<T> {
|
||||
T createFromParcel(Parcel source);
|
||||
T[] newArray(int size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//FILE: test.kt
|
||||
package test
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class Foo(val parcelable: Parcelable): Parcelable
|
||||
@@ -0,0 +1,66 @@
|
||||
public final class test/Foo$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final test.Foo createFromParcel(android.os.Parcel in) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (in)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
LDC (Ltest/Foo;)
|
||||
INVOKEVIRTUAL (java/lang/Class, getClassLoader, ()Ljava/lang/ClassLoader;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readParcelable, (Ljava/lang/ClassLoader;)Landroid/os/Parcelable;)
|
||||
INVOKESPECIAL (test/Foo, <init>, (Landroid/os/Parcelable;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (8)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (test/Foo$Creator, createFromParcel, (Landroid/os/Parcel;)Ltest/Foo;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public final test.Foo[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class test/Foo : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final android.os.Parcelable parcelable
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (test/Foo$Creator, <init>, ()V)
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(android.os.Parcelable parcelable)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final android.os.Parcelable getParcelable()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (parcelable, Landroid/os/Parcelable;)
|
||||
ILOAD (2)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeParcelable, (Landroid/os/Parcelable;I)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
public final class SerializableSimple : java/lang/Object, java/io/Serializable {
|
||||
private final java.lang.String a
|
||||
|
||||
private final java.lang.String b
|
||||
|
||||
public void <init>(java.lang.String a, java.lang.String b)
|
||||
|
||||
public final java.lang.String getA()
|
||||
|
||||
public final java.lang.String getB()
|
||||
}
|
||||
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel parcel) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readSerializable, ()Ljava/io/Serializable;)
|
||||
CHECKCAST
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readSerializable, ()Ljava/io/Serializable;)
|
||||
CHECKCAST
|
||||
INVOKESPECIAL (User, <init>, (LSerializableSimple;LSerializableSimple;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (User$Creator, createFromParcel, (Landroid/os/Parcel;)LUser;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final User[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final SerializableSimple notNull
|
||||
|
||||
private final SerializableSimple nullable
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (User$Creator, <init>, ()V)
|
||||
CHECKCAST
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(SerializableSimple notNull, SerializableSimple nullable)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final SerializableSimple getNotNull()
|
||||
|
||||
public final SerializableSimple getNullable()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (notNull, LSerializableSimple;)
|
||||
CHECKCAST
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeSerializable, (Ljava/io/Serializable;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (nullable, LSerializableSimple;)
|
||||
CHECKCAST
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeSerializable, (Ljava/io/Serializable;)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// CURIOUS_ABOUT writeToParcel, createFromParcel, <clinit>
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcelable
|
||||
import java.io.Serializable
|
||||
|
||||
class SerializableSimple(val a: String, val b: String) : Serializable
|
||||
|
||||
@Parcelize
|
||||
class User(val notNull: SerializableSimple, val nullable: SerializableSimple) : Parcelable
|
||||
@@ -0,0 +1,87 @@
|
||||
public final class SerializableSimple : java/lang/Object, java/io/Serializable {
|
||||
private final java.lang.String a
|
||||
|
||||
private final java.lang.String b
|
||||
|
||||
public void <init>(java.lang.String a, java.lang.String b)
|
||||
|
||||
public final java.lang.String getA()
|
||||
|
||||
public final java.lang.String getB()
|
||||
}
|
||||
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final User createFromParcel(android.os.Parcel in) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (in)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readSerializable, ()Ljava/io/Serializable;)
|
||||
CHECKCAST
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readSerializable, ()Ljava/io/Serializable;)
|
||||
CHECKCAST
|
||||
INVOKESPECIAL (User, <init>, (LSerializableSimple;LSerializableSimple;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (11)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (User$Creator, createFromParcel, (Landroid/os/Parcel;)LUser;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public final User[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final SerializableSimple notNull
|
||||
|
||||
private final SerializableSimple nullable
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (User$Creator, <init>, ()V)
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(SerializableSimple notNull, SerializableSimple nullable)
|
||||
|
||||
public int describeContents()
|
||||
|
||||
public final SerializableSimple getNotNull()
|
||||
|
||||
public final SerializableSimple getNullable()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (notNull, LSerializableSimple;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeSerializable, (Ljava/io/Serializable;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (nullable, LSerializableSimple;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeSerializable, (Ljava/io/Serializable;)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
public final class Test$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final Test createFromParcel(android.os.Parcel parcel) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
LDC (LTest;)
|
||||
INVOKEVIRTUAL (java/lang/Class, getClassLoader, ()Ljava/lang/ClassLoader;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readValue, (Ljava/lang/ClassLoader;)Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
INVOKESPECIAL (Test, <init>, (LValue;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source) {
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (Test$Creator, createFromParcel, (Landroid/os/Parcel;)LTest;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final Test[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int size)
|
||||
}
|
||||
|
||||
public final class Test : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final Value value
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (Test$Creator, <init>, ()V)
|
||||
CHECKCAST
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(Value value)
|
||||
|
||||
public int describeContents() {
|
||||
LABEL (L0)
|
||||
ICONST_0
|
||||
IRETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final Value getValue()
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (value, LValue;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeValue, (Ljava/lang/Object;)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
|
||||
public final class Value : java/lang/Object {
|
||||
private final int x
|
||||
|
||||
public void <init>(int x)
|
||||
|
||||
public final int getX()
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// CURIOUS_ABOUT writeToParcel, createFromParcel, <clinit>, describeContents
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcelable
|
||||
|
||||
class Value(val x: Int)
|
||||
|
||||
@Parcelize
|
||||
class Test(val value: @RawValue Value) : Parcelable
|
||||
@@ -0,0 +1,79 @@
|
||||
public final class Test$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>()
|
||||
|
||||
public final Test createFromParcel(android.os.Parcel in) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (in)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
LDC (LValue;)
|
||||
INVOKEVIRTUAL (java/lang/Class, getClassLoader, ()Ljava/lang/ClassLoader;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readValue, (Ljava/lang/ClassLoader;)Ljava/lang/Object;)
|
||||
CHECKCAST
|
||||
INVOKESPECIAL (Test, <init>, (LValue;)V)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel p0) {
|
||||
LABEL (L0)
|
||||
LINENUMBER (10)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (Test$Creator, createFromParcel, (Landroid/os/Parcel;)LTest;)
|
||||
ARETURN
|
||||
}
|
||||
|
||||
public final Test[] newArray(int size)
|
||||
|
||||
public java.lang.Object[] newArray(int p0)
|
||||
}
|
||||
|
||||
public final class Test : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final Value value
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (Test$Creator, <init>, ()V)
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(Value value)
|
||||
|
||||
public int describeContents() {
|
||||
LABEL (L0)
|
||||
LDC (0)
|
||||
IRETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final Value getValue()
|
||||
|
||||
public void writeToParcel(android.os.Parcel parcel, int flags) {
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (value, LValue;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeValue, (Ljava/lang/Object;)V)
|
||||
RETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
}
|
||||
|
||||
public final class Value : java/lang/Object {
|
||||
private final int x
|
||||
|
||||
public void <init>(int x)
|
||||
|
||||
public final int getX()
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
public final class User$Creator : java/lang/Object, android/os/Parcelable$Creator {
|
||||
public void <init>() {
|
||||
Local variables:
|
||||
0 this: LUser$Creator;
|
||||
}
|
||||
|
||||
public final User createFromParcel(android.os.Parcel parcel) {
|
||||
Local variables:
|
||||
0 this: LUser$Creator;
|
||||
1 parcel: Landroid/os/Parcel;
|
||||
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (parcel)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
LABEL (L1)
|
||||
NEW
|
||||
DUP
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readString, ()Ljava/lang/String;)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readString, ()Ljava/lang/String;)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readInt, ()I)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (android/os/Parcel, readInt, ()I)
|
||||
IFEQ (L2)
|
||||
ICONST_1
|
||||
GOTO (L3)
|
||||
LABEL (L2)
|
||||
ICONST_0
|
||||
LABEL (L3)
|
||||
INVOKESPECIAL (User, <init>, (Ljava/lang/String;Ljava/lang/String;IZ)V)
|
||||
ARETURN
|
||||
LABEL (L4)
|
||||
}
|
||||
|
||||
public java.lang.Object createFromParcel(android.os.Parcel source) {
|
||||
Local variables:
|
||||
0 this: LUser$Creator;
|
||||
1 source: Landroid/os/Parcel;
|
||||
|
||||
LABEL (L0)
|
||||
ALOAD (0)
|
||||
ALOAD (1)
|
||||
INVOKEVIRTUAL (User$Creator, createFromParcel, (Landroid/os/Parcel;)LUser;)
|
||||
ARETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final User[] newArray(int size) {
|
||||
Local variables:
|
||||
0 this: LUser$Creator;
|
||||
1 size: I
|
||||
}
|
||||
|
||||
public java.lang.Object[] newArray(int size) {
|
||||
Local variables:
|
||||
0 this: LUser$Creator;
|
||||
1 size: I
|
||||
}
|
||||
}
|
||||
|
||||
public final class User : java/lang/Object, android/os/Parcelable {
|
||||
public final static android.os.Parcelable$Creator CREATOR
|
||||
|
||||
private final int age
|
||||
|
||||
private final java.lang.String firstName
|
||||
|
||||
private final boolean isProUser
|
||||
|
||||
private final java.lang.String lastName
|
||||
|
||||
static void <clinit>() {
|
||||
NEW
|
||||
DUP
|
||||
INVOKESPECIAL (User$Creator, <init>, ()V)
|
||||
CHECKCAST
|
||||
PUTSTATIC (CREATOR, Landroid/os/Parcelable$Creator;)
|
||||
RETURN
|
||||
}
|
||||
|
||||
public void <init>(java.lang.String firstName, java.lang.String lastName, int age, boolean isProUser) {
|
||||
Local variables:
|
||||
0 this: LUser;
|
||||
1 firstName: Ljava/lang/String;
|
||||
2 lastName: Ljava/lang/String;
|
||||
3 age: I
|
||||
4 isProUser: Z
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
Local variables:
|
||||
0 this: LUser;
|
||||
|
||||
LABEL (L0)
|
||||
ICONST_0
|
||||
IRETURN
|
||||
LABEL (L1)
|
||||
}
|
||||
|
||||
public final int getAge() {
|
||||
Local variables:
|
||||
0 this: LUser;
|
||||
}
|
||||
|
||||
public final java.lang.String getFirstName() {
|
||||
Local variables:
|
||||
0 this: LUser;
|
||||
}
|
||||
|
||||
public final java.lang.String getLastName() {
|
||||
Local variables:
|
||||
0 this: LUser;
|
||||
}
|
||||
|
||||
public final boolean isProUser() {
|
||||
Local variables:
|
||||
0 this: LUser;
|
||||
}
|
||||
|
||||
public void writeToParcel(android.os.Parcel out, int flags) {
|
||||
Local variables:
|
||||
0 this: LUser;
|
||||
1 out: Landroid/os/Parcel;
|
||||
2 flags: I
|
||||
|
||||
LABEL (L0)
|
||||
ALOAD (1)
|
||||
LDC (out)
|
||||
INVOKESTATIC (kotlin/jvm/internal/Intrinsics, checkNotNullParameter, (Ljava/lang/Object;Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (firstName, Ljava/lang/String;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeString, (Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (lastName, Ljava/lang/String;)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeString, (Ljava/lang/String;)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (age, I)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
ALOAD (1)
|
||||
ALOAD (0)
|
||||
GETFIELD (isProUser, Z)
|
||||
IFEQ (L1)
|
||||
ICONST_1
|
||||
GOTO (L2)
|
||||
LABEL (L1)
|
||||
ICONST_0
|
||||
LABEL (L2)
|
||||
INVOKEVIRTUAL (android/os/Parcel, writeInt, (I)V)
|
||||
RETURN
|
||||
LABEL (L3)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// CURIOUS_ABOUT writeToParcel, createFromParcel, <clinit>, describeContents
|
||||
// WITH_RUNTIME
|
||||
// LOCAL_VARIABLE_TABLE
|
||||
|
||||
import kotlinx.parcelize.*
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class User(val firstName: String, val lastName: String, val age: Int, val isProUser: Boolean) : Parcelable
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user