Parcelable: Parcelize overrides describeContents despite being already implemented (KT-20026)
This commit is contained in:
committed by
Yan Zhulanow
parent
e645da64da
commit
32fc340d62
+4
-1
@@ -93,6 +93,7 @@ open class ParcelableResolveExtension : SyntheticResolveExtension {
|
||||
&& clazz.isParcelize
|
||||
&& isExperimental()
|
||||
&& result.none { it.isDescribeContents() }
|
||||
&& fromSupertypes.none { it.isDescribeContents() }
|
||||
) {
|
||||
result += createMethod(clazz, DESCRIBE_CONTENTS, clazz.builtIns.intType)
|
||||
} else if (name.asString() == WRITE_TO_PARCEL.methodName
|
||||
@@ -107,7 +108,9 @@ open class ParcelableResolveExtension : SyntheticResolveExtension {
|
||||
}
|
||||
|
||||
private fun SimpleFunctionDescriptor.isDescribeContents(): Boolean {
|
||||
return typeParameters.isEmpty()
|
||||
return this.kind != CallableMemberDescriptor.Kind.FAKE_OVERRIDE
|
||||
&& modality != Modality.ABSTRACT
|
||||
&& typeParameters.isEmpty()
|
||||
&& valueParameters.isEmpty()
|
||||
&& returnType?.let { type -> KotlinBuiltIns.isInt(type) } == true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user