Parcelize: Add the Parcelize compiler plugin with sources extracted from Android Extensions plugin (KT-40030)

This commit is contained in:
Yan Zhulanow
2020-07-07 19:30:23 +09:00
parent c9bca165bc
commit b7796d63d8
152 changed files with 11872 additions and 0 deletions
+18
View File
@@ -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
}