0d36462c58
A previous fix to the generator made the generator and checker validation of classes which could be parcelized different. The checker would report error in cases where the generator would not generate anything. Align these checks, with improved code sharing, so errors are not reported on classes which will not have parcelize components generated. ^KT-63086 Fixed
39 lines
888 B
Kotlin
Vendored
39 lines
888 B
Kotlin
Vendored
package test
|
|
|
|
import kotlinx.parcelize.Parcelize
|
|
import android.os.Parcelable
|
|
|
|
@Parcelize
|
|
open class Open(val foo: String) : Parcelable
|
|
|
|
data class Derived(val bar: String) : Open(bar)
|
|
|
|
@Parcelize
|
|
class Final(val foo: String) : Parcelable
|
|
|
|
@Parcelize
|
|
<!PARCELABLE_SHOULD_BE_INSTANTIABLE!>abstract<!> class Abstract(val foo: String) : Parcelable
|
|
|
|
@Parcelize
|
|
sealed class Sealed(val foo: String) : Parcelable {
|
|
class X : Sealed("")
|
|
sealed class Inner : Sealed("") {
|
|
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class Y<!> : Inner()
|
|
}
|
|
}
|
|
|
|
class Outer {
|
|
@Parcelize
|
|
<!PARCELABLE_CANT_BE_INNER_CLASS!>inner<!> class Inner(val foo: String) : Parcelable
|
|
}
|
|
|
|
fun foo() {
|
|
@Parcelize
|
|
<!PARCELABLE_CANT_BE_LOCAL_CLASS!>object<!> : Parcelable {}
|
|
|
|
object : Open("") {}
|
|
|
|
@Parcelize
|
|
class <!NO_PARCELABLE_SUPERTYPE, PARCELABLE_CANT_BE_LOCAL_CLASS!>Local<!> {}
|
|
}
|