@@ -319,6 +319,89 @@ class KaptIsRedundantWithUnusedProcsProject(agpVersion: String) {
319319 val expectedAdvice = setOf (PluginAdvice .redundantKapt())
320320}
321321
322+ class KotlinParcelizeIsNotRedundantProject (agpVersion : String ) {
323+
324+ fun newProject () = AndroidProject (
325+ rootSpec = rootSpec,
326+ appSpec = appSpec
327+ )
328+
329+ val rootSpec = RootSpec (agpVersion = agpVersion)
330+
331+ private val sources = mapOf (
332+ " Thing.kt" to """
333+ package $DEFAULT_PACKAGE_NAME
334+
335+ import android.os.Parcelable
336+ import kotlinx.parcelize.Parcelize
337+
338+ @Parcelize
339+ data class Thing(val id: String) : Parcelable
340+ """ .trimIndent()
341+ )
342+
343+ val appSpec = AppSpec (
344+ plugins = setOf (" kotlin-parcelize" ),
345+ sources = sources,
346+ dependencies = listOf (
347+ " implementation" to " org.jetbrains.kotlin:kotlin-stdlib:${Plugin .KOTLIN_VERSION } " ,
348+ " implementation" to APPCOMPAT
349+ )
350+ )
351+
352+ val expectedAdvice = emptySet<PluginAdvice >()
353+ }
354+
355+ class KotlinParcelizeIsRedundantProject (agpVersion : String ) {
356+
357+ fun newProject () = AndroidProject (
358+ rootSpec = rootSpec,
359+ appSpec = appSpec
360+ )
361+
362+ val rootSpec = RootSpec (agpVersion = agpVersion)
363+
364+ private val sources = mapOf (
365+ " Thing.kt" to """
366+ package $DEFAULT_PACKAGE_NAME
367+
368+ import android.os.Parcel
369+ import android.os.Parcelable
370+
371+ data class Thing(val id: String) : Parcelable {
372+ constructor(parcel: Parcel) : this(parcel.readString()!!)
373+
374+ override fun describeContents() = 0
375+
376+ override fun writeToParcel(dest: Parcel, flags: Int) {
377+ dest.writeString(id)
378+ }
379+
380+ companion object CREATOR : Parcelable.Creator<Thing> {
381+ override fun createFromParcel(parcel: Parcel): Thing {
382+ return Thing(parcel)
383+ }
384+
385+ override fun newArray(size: Int): Array<Thing?> {
386+ return arrayOfNulls(size)
387+ }
388+ }
389+ }
390+ """ .trimIndent()
391+ )
392+
393+ val appSpec = AppSpec (
394+ plugins = setOf (" kotlin-parcelize" ),
395+ sources = sources,
396+ dependencies = listOf (
397+ " implementation" to " org.jetbrains.kotlin:kotlin-stdlib:${Plugin .KOTLIN_VERSION } " ,
398+ " implementation" to APPCOMPAT
399+ )
400+ )
401+
402+ val expectedAdvice = setOf (PluginAdvice .redundantKotlinParcelize())
403+ }
404+
322405private val transitiveDagger = ModuleCoordinates (" com.google.dagger:dagger" , " 2.24" , GradleVariantIdentification (emptySet(), emptyMap()))
323406private val transitiveInject = ModuleCoordinates (" javax.inject:javax.inject" , " 1" , GradleVariantIdentification (emptySet(), emptyMap()))
324407private val transitiveInject2 = ModuleCoordinates (" javax.inject:javax.inject" , " 1" , GradleVariantIdentification (emptySet(), emptyMap()))
0 commit comments