Parcelize: Add a test for Java interop (KT-25807)
This commit is contained in:
committed by
Alexander Udalov
parent
aa0eeba327
commit
21637c828e
+5
@@ -94,6 +94,11 @@ public class ParcelBoxTestGenerated extends AbstractParcelBoxTest {
|
|||||||
runTest("plugins/android-extensions/android-extensions-compiler/testData/parcel/box/intArray.kt");
|
runTest("plugins/android-extensions/android-extensions-compiler/testData/parcel/box/intArray.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("javaInterop.kt")
|
||||||
|
public void testJavaInterop() throws Exception {
|
||||||
|
runTest("plugins/android-extensions/android-extensions-compiler/testData/parcel/box/javaInterop.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt19747.kt")
|
@TestMetadata("kt19747.kt")
|
||||||
public void testKt19747() throws Exception {
|
public void testKt19747() throws Exception {
|
||||||
runTest("plugins/android-extensions/android-extensions-compiler/testData/parcel/box/kt19747.kt");
|
runTest("plugins/android-extensions/android-extensions-compiler/testData/parcel/box/kt19747.kt");
|
||||||
|
|||||||
+5
@@ -94,6 +94,11 @@ public class ParcelIrBoxTestGenerated extends AbstractParcelIrBoxTest {
|
|||||||
runTest("plugins/android-extensions/android-extensions-compiler/testData/parcel/box/intArray.kt");
|
runTest("plugins/android-extensions/android-extensions-compiler/testData/parcel/box/intArray.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("javaInterop.kt")
|
||||||
|
public void testJavaInterop() throws Exception {
|
||||||
|
runTest("plugins/android-extensions/android-extensions-compiler/testData/parcel/box/javaInterop.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt19747.kt")
|
@TestMetadata("kt19747.kt")
|
||||||
public void testKt19747() throws Exception {
|
public void testKt19747() throws Exception {
|
||||||
runTest("plugins/android-extensions/android-extensions-compiler/testData/parcel/box/kt19747.kt");
|
runTest("plugins/android-extensions/android-extensions-compiler/testData/parcel/box/kt19747.kt");
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
// IGNORE_BACKEND: JVM
|
||||||
|
// 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.android.parcel.*
|
||||||
|
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)
|
||||||
|
|
||||||
|
val second = J.readParcel(parcel)
|
||||||
|
assert(first == second)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user