Parcelable, minor: Rename MagicParcel to Parcelize
This commit is contained in:
+3
-3
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.android.synthetic.codegen
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.android.parcel.isMagicParcelable
|
||||
import org.jetbrains.kotlin.android.parcel.isParcelize
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilder
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilderFactory
|
||||
import org.jetbrains.kotlin.codegen.DelegatingClassBuilder
|
||||
@@ -97,7 +97,7 @@ class ParcelableClinitClassBuilderInterceptorExtension : ClassBuilderInterceptor
|
||||
override fun done() {
|
||||
if (!isClinitGenerated && currentClass != null && currentClassName != null) {
|
||||
val descriptor = bindingContext[BindingContext.CLASS, currentClass]
|
||||
if (descriptor != null && descriptor.isMagicParcelable) {
|
||||
if (descriptor != null && descriptor.isParcelize) {
|
||||
val baseVisitor = super.newMethod(JvmDeclarationOrigin.NO_ORIGIN, ACC_STATIC, "<clinit>", "()V", null, null)
|
||||
val visitor = ClinitAwareMethodVisitor(currentClassName!!, baseVisitor)
|
||||
|
||||
@@ -122,7 +122,7 @@ class ParcelableClinitClassBuilderInterceptorExtension : ClassBuilderInterceptor
|
||||
isClinitGenerated = true
|
||||
|
||||
val descriptor = bindingContext[BindingContext.CLASS, currentClass]
|
||||
if (descriptor != null && descriptor.isMagicParcelable) {
|
||||
if (descriptor != null && descriptor.isParcelize) {
|
||||
return ClinitAwareMethodVisitor(
|
||||
currentClassName!!,
|
||||
super.newMethod(origin, access, name, desc, signature, exceptions))
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ open class ParcelableCodegenExtension : ExpressionCodegenExtension {
|
||||
|
||||
override fun generateClassSyntheticParts(codegen: ImplementationBodyCodegen) {
|
||||
val parcelableClass = codegen.descriptor
|
||||
if (!parcelableClass.isMagicParcelable) return
|
||||
if (!parcelableClass.isParcelize) return
|
||||
|
||||
val sourceElement = (codegen.myClass as? KtClassOrObject) ?: return
|
||||
if (!isExperimental(sourceElement)) return
|
||||
|
||||
+4
-4
@@ -78,7 +78,7 @@ class ParcelableDeclarationChecker : SimpleDeclarationChecker {
|
||||
declaration: KtFunction,
|
||||
diagnosticHolder: DiagnosticSink
|
||||
) {
|
||||
if (!containingClass.isMagicParcelable) return
|
||||
if (!containingClass.isParcelize) return
|
||||
|
||||
if (method.isWriteToParcel() && declaration.hasModifier(KtTokens.OVERRIDE_KEYWORD)) {
|
||||
val reportElement = declaration.modifierList?.getModifier(KtTokens.OVERRIDE_KEYWORD) ?: declaration.nameIdentifier ?: declaration
|
||||
@@ -93,7 +93,7 @@ class ParcelableDeclarationChecker : SimpleDeclarationChecker {
|
||||
diagnosticHolder: DiagnosticSink,
|
||||
bindingContext: BindingContext
|
||||
) {
|
||||
if (containingClass.isMagicParcelable
|
||||
if (containingClass.isParcelize
|
||||
&& (declaration.hasDelegate() || bindingContext[BindingContext.BACKING_FIELD_REQUIRED, property] == true)
|
||||
&& !property.annotations.hasAnnotation(TRANSIENT_FQNAME)
|
||||
) {
|
||||
@@ -103,7 +103,7 @@ class ParcelableDeclarationChecker : SimpleDeclarationChecker {
|
||||
// @JvmName is not applicable to property so we can check just the descriptor name
|
||||
if (property.name.asString() == "CREATOR" && property.findJvmFieldAnnotation() != null && containingClass.isCompanionObject) {
|
||||
val outerClass = containingClass.containingDeclaration as? ClassDescriptor
|
||||
if (outerClass != null && outerClass.isMagicParcelable) {
|
||||
if (outerClass != null && outerClass.isParcelize) {
|
||||
diagnosticHolder.report(ErrorsAndroid.CREATOR_DEFINITION_IS_NOT_ALLOWED.on(declaration.nameIdentifier ?: declaration))
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class ParcelableDeclarationChecker : SimpleDeclarationChecker {
|
||||
diagnosticHolder: DiagnosticSink,
|
||||
bindingContext: BindingContext
|
||||
) {
|
||||
if (!descriptor.isMagicParcelable) return
|
||||
if (!descriptor.isParcelize) return
|
||||
|
||||
if (declaration !is KtClass || (declaration.isAnnotation() || declaration.isInterface())) {
|
||||
val reportElement = (declaration as? KtClassOrObject)?.nameIdentifier ?: declaration
|
||||
|
||||
+6
-6
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.android.parcel
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import org.jetbrains.kotlin.android.parcel.ParcelableSyntheticComponent.ComponentKind.*
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
@@ -90,13 +90,13 @@ open class ParcelableResolveExtension : SyntheticResolveExtension {
|
||||
}
|
||||
|
||||
if (name.asString() == DESCRIBE_CONTENTS.methodName
|
||||
&& clazz.isMagicParcelable
|
||||
&& clazz.isParcelize
|
||||
&& isExperimental()
|
||||
&& result.none { it.isDescribeContents() }
|
||||
) {
|
||||
result += createMethod(clazz, DESCRIBE_CONTENTS, clazz.builtIns.intType)
|
||||
} else if (name.asString() == WRITE_TO_PARCEL.methodName
|
||||
&& clazz.isMagicParcelable
|
||||
&& clazz.isParcelize
|
||||
&& isExperimental()
|
||||
&& result.none { it.isWriteToParcel() }
|
||||
) {
|
||||
@@ -133,7 +133,7 @@ interface ParcelableSyntheticComponent {
|
||||
}
|
||||
}
|
||||
|
||||
private val MAGIC_PARCEL_CLASS_FQNAME = FqName(MagicParcel::class.java.canonicalName)
|
||||
private val PARCELIZE_CLASS_FQNAME = FqName(Parcelize::class.java.canonicalName)
|
||||
|
||||
internal val ClassDescriptor.isMagicParcelable: Boolean
|
||||
get() = this.annotations.hasAnnotation(MAGIC_PARCEL_CLASS_FQNAME)
|
||||
internal val ClassDescriptor.isParcelize: Boolean
|
||||
get() = this.annotations.hasAnnotation(PARCELIZE_CLASS_FQNAME)
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.android.parcel.serializers
|
||||
|
||||
import org.jetbrains.kotlin.android.parcel.isMagicParcelable
|
||||
import org.jetbrains.kotlin.android.parcel.isParcelize
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
@@ -181,7 +181,7 @@ interface ParcelSerializer {
|
||||
|
||||
val creatorAsmType = when {
|
||||
creatorVar != null -> typeMapper.mapTypeSafe(creatorVar.type)
|
||||
clazz.isMagicParcelable -> Type.getObjectType(asmType.internalName + "\$Creator")
|
||||
clazz.isParcelize -> Type.getObjectType(asmType.internalName + "\$Creator")
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ class DefaultErrorMessagesAndroid : DefaultErrorMessages.Extension {
|
||||
"'CREATOR' definition is not allowed. Use 'Parceler' companion object instead.")
|
||||
|
||||
MAP.put(ErrorsAndroid.PARCELABLE_TYPE_NOT_SUPPORTED,
|
||||
"Type is not directly supported by 'MagicParcelable'. " +
|
||||
"Type is not directly supported by 'Parcelize'. " +
|
||||
"Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'")
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.Arrays
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(val a: Array<String>) : Parcelable {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.Arrays
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val a: Array<String>,
|
||||
val b: Array<String?>,
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class BoxedTypes(
|
||||
val boo: java.lang.Boolean,
|
||||
val c: java.lang.Character,
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.os.Bundle
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class User(val a: Bundle) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.text.SpannableString
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(val simple: CharSequence, val spanned: CharSequence) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@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) {
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ enum class Color {
|
||||
BLACK, WHITE
|
||||
}
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(val name: String, val color: Color) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.*
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val a: List<String>,
|
||||
val b: MutableList<String>,
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(val a: List<String>) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val a: List<String>,
|
||||
val b: List<String?>,
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import java.util.*
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val a: Map<String, String>,
|
||||
val b: MutableMap<String, String>,
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(val a: Map<String, String>) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val a: Map<String, String>,
|
||||
val b: Map<String?, String>,
|
||||
|
||||
Vendored
+3
-3
@@ -10,15 +10,15 @@ import android.os.Parcelable
|
||||
// Starts with A, should be loaded before other classes
|
||||
abstract class AParcelable : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class P1(val a: String) : AParcelable()
|
||||
|
||||
sealed class Sealed : AParcelable()
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Sealed1(val a: Int) : Sealed()
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(val a: P1, val b: AParcelable, val c: Sealed, val d: Sealed1) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(
|
||||
val str1: String,
|
||||
val str2: String?,
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(val a: String?) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ object Obj1 {
|
||||
object Obj2
|
||||
}
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(val o1: Obj1, val o2: Obj1.Obj2, val com: Com) : Parcelable {
|
||||
companion object Com {
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class PrimitiveTypes(
|
||||
val boo: Boolean,
|
||||
val c: Char,
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class User(val firstName: String, val secondName: String, val age: Int) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
|
||||
+2
-2
@@ -8,10 +8,10 @@ import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.util.*
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Data(val a: String, val b: String) : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class User(val a: SparseIntArray, val b: SparseLongArray, val c: SparseArray<Data>) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
|
||||
Vendored
+1
-1
@@ -8,7 +8,7 @@ import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.util.SparseBooleanArray
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class User(val a: SparseBooleanArray) : Parcelable
|
||||
|
||||
fun box() = parcelTest { parcel ->
|
||||
|
||||
Vendored
+1
-1
@@ -5,5 +5,5 @@ import android.os.Parcelable
|
||||
import android.os.IBinder
|
||||
import android.os.IInterface
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class User(val binder: IBinder, val intf: IInterface?) : Parcelable
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
import kotlinx.android.parcel.*
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class User(val firstName: String, val lastName: String, val age: Int, val isProUser: Boolean) : Parcelable {
|
||||
override fun describeContents() = 100
|
||||
}
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@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) {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@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) {
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@ import kotlinx.android.parcel.*
|
||||
import android.os.Parcelable
|
||||
import kotlin.jvm.JvmStatic
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class User(val firstName: String) : Parcelable {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
|
||||
Vendored
+1
-1
@@ -2,5 +2,5 @@
|
||||
|
||||
import kotlinx.android.parcel.*
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class Test(val names: List<List<List<String>>>)
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
import android.util.Size
|
||||
import kotlinx.android.parcel.*
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class TestNullable(val a: Size?)
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class TestNotNull(val a: Size)
|
||||
Vendored
+1
-1
@@ -6,5 +6,5 @@ import java.io.Serializable
|
||||
|
||||
class SerializableSimple(val a: String, val b: String) : Serializable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class User(val notNull: SerializableSimple, val nullable: SerializableSimple) : Parcelable
|
||||
+1
-1
@@ -3,5 +3,5 @@
|
||||
import kotlinx.android.parcel.*
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class User(val firstName: String, val lastName: String, val age: Int, val isProUser: Boolean) : Parcelable
|
||||
Vendored
+1
-1
@@ -2,5 +2,5 @@
|
||||
|
||||
import kotlinx.android.parcel.*
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class Test(val names: List<String>)
|
||||
+2
-2
@@ -5,8 +5,8 @@ import android.os.Parcelable
|
||||
import android.util.Size
|
||||
import android.util.SizeF
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class Test(val size: Size, val nullable: Size?) : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
data class TestF(val size: SizeF, val nullable: SizeF?) : Parcelable
|
||||
Vendored
+7
-7
@@ -1,26 +1,26 @@
|
||||
package test
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class A : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class B(val firstName: String, val secondName: String) : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class C(val firstName: String, <error descr="[PARCELABLE_CONSTRUCTOR_PARAMETER_SHOULD_BE_VAL_OR_VAR] 'Parcelable' constructor parameter should be 'val' or 'var'">secondName</error>: String) : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class D(val firstName: String, vararg val secondName: String) : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class E(val firstName: String, val secondName: String) : Parcelable {
|
||||
constructor() : this("", "")
|
||||
}
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class <error descr="[PARCELABLE_SHOULD_HAVE_PRIMARY_CONSTRUCTOR] 'Parcelable' should have a primary constructor">F</error> : Parcelable {
|
||||
constructor(a: String) {
|
||||
println(a)
|
||||
|
||||
Vendored
+2
-2
@@ -1,10 +1,10 @@
|
||||
package test
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcelable
|
||||
import android.os.Parcel
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class A(val a: String) : Parcelable {
|
||||
companion object {
|
||||
@JvmField
|
||||
|
||||
+4
-4
@@ -1,21 +1,21 @@
|
||||
package test
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcelable
|
||||
import android.os.Parcel
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class A(val a: String) : Parcelable {
|
||||
<error descr="[OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED] Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.">override</error> fun writeToParcel(p: Parcel?, flags: Int) {}
|
||||
override fun describeContents() = 0
|
||||
}
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class B(val a: String) : Parcelable {
|
||||
<error descr="[OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED] Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.">override</error> fun writeToParcel(p: Parcel?, flags: Int) {}
|
||||
}
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class C(val a: String) : Parcelable {
|
||||
<error descr="[OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED] Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead.">override</error> fun writeToParcel(p: Parcel, flags: Int) {}
|
||||
}
|
||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
package test
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcelable
|
||||
import android.os.Parcel
|
||||
|
||||
@@ -9,5 +9,5 @@ open class Delegate : Parcelable {
|
||||
override fun describeContents() = 0
|
||||
}
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class Test : Parcelable <error descr="[PARCELABLE_DELEGATE_IS_NOT_ALLOWED] Delegating 'Parcelable' is now allowed">by</error> Delegate()
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
package test
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class User : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class <warning descr="[PARCELABLE_PRIMARY_CONSTRUCTOR_IS_EMPTY] The primary constructor is empty, no data will be serialized to 'Parcel'">User2</warning>() : Parcelable
|
||||
Vendored
+8
-8
@@ -1,31 +1,31 @@
|
||||
package test
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
open class Open(val foo: String) : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class Final(val foo: String) : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
<error descr="[PARCELABLE_SHOULD_BE_INSTANTIABLE] 'Parcelable' should not be a 'sealed' or 'abstract' class">abstract</error> class Abstract(val foo: String) : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
<error descr="[PARCELABLE_SHOULD_BE_INSTANTIABLE] 'Parcelable' should not be a 'sealed' or 'abstract' class">sealed</error> class Sealed(val foo: String) : Parcelable {
|
||||
class X : Sealed("")
|
||||
}
|
||||
|
||||
class Outer {
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
<error descr="[PARCELABLE_CANT_BE_INNER_CLASS] 'Parcelable' can't be an inner class">inner</error> class Inner(val foo: String) : Parcelable
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
<error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">object</error> : Parcelable {}
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class <error descr="[NO_PARCELABLE_SUPERTYPE] No 'Parcelable' supertype"><error descr="[PARCELABLE_CANT_BE_LOCAL_CLASS] 'Parcelable' can't be a local class">Local</error></error> {}
|
||||
}
|
||||
plugins/android-extensions/android-extensions-idea/testData/android/parcel/checker/notMagicParcel.kt
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
package test
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class A(val firstName: String) : Parcelable {
|
||||
val <warning descr="[PROPERTY_WONT_BE_SERIALIZED] Property would not be serialized into a 'Parcel'. Add '@Transient' annotation to it">secondName</warning>: String = ""
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
package test
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class User(val firstName: String, val secondName: String, val age: Int) : Parcelable
|
||||
+5
-5
@@ -1,15 +1,15 @@
|
||||
package test
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import kotlinx.android.parcel.RawValue
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class User(
|
||||
val a: String,
|
||||
val b: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'MagicParcelable'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Any</error>,
|
||||
val c: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'MagicParcelable'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Any?</error>,
|
||||
val d: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'MagicParcelable'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Map<Any, String></error>,
|
||||
val b: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Any</error>,
|
||||
val c: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Any?</error>,
|
||||
val d: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Map<Any, String></error>,
|
||||
val e: @RawValue Any?,
|
||||
val f: @RawValue Map<String, Any>,
|
||||
val g: Map<String, @RawValue Any>,
|
||||
|
||||
+5
-5
@@ -1,20 +1,20 @@
|
||||
package test
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class <error descr="[NO_PARCELABLE_SUPERTYPE] No 'Parcelable' supertype">Without</error>(val firstName: String, val secondName: String, val age: Int)
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class With(val firstName: String, val secondName: String, val age: Int) : Parcelable
|
||||
|
||||
interface MyParcelableIntf : Parcelable
|
||||
|
||||
abstract class MyParcelableCl : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class WithIntfSubtype(val firstName: String, val secondName: String, val age: Int) : MyParcelableIntf
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
class WithClSubtype(val firstName: String, val secondName: String, val age: Int) : MyParcelableCl()
|
||||
+6
-6
@@ -1,25 +1,25 @@
|
||||
package test
|
||||
|
||||
import kotlinx.android.parcel.MagicParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import android.os.Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
interface <error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">Intf</error> : Parcelable
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
object <error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">Obj</error>
|
||||
|
||||
class A {
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
companion <error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">object</error> {
|
||||
fun foo() {}
|
||||
}
|
||||
}
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
enum class <error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">Enum</error> {
|
||||
WHITE, BLACK
|
||||
}
|
||||
|
||||
@MagicParcel
|
||||
@Parcelize
|
||||
annotation class <error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">Anno</error>
|
||||
+1
-1
@@ -25,4 +25,4 @@ package kotlinx.android.parcel
|
||||
*/
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class MagicParcel
|
||||
annotation class Parcelize
|
||||
Reference in New Issue
Block a user