Parcelable: Give priority to Parcelable type over objects and enums (KT-20021)

This commit is contained in:
Yan Zhulanow
2017-09-01 22:58:22 +03:00
committed by Yan Zhulanow
parent be3273a933
commit 7b96c9a003
3 changed files with 52 additions and 6 deletions
@@ -167,12 +167,6 @@ interface ParcelSerializer {
Method("writeException"),
Method("readException")))
// Write at least a nullability byte.
// We don't want parcel to be empty in case if all constructor parameters are objects
type.isNamedObject() -> NullAwareParcelSerializerWrapper(ObjectParcelSerializer(asmType, type, typeMapper))
type.isEnum() -> wrapToNullAwareIfNeeded(type, EnumParcelSerializer(asmType))
asmType.isFileDescriptor() -> wrapToNullAwareIfNeeded(type, NullCompliantObjectParcelSerializer(asmType,
Method("writeRawFileDescriptor"),
Method("readRawFileDescriptor")))
@@ -197,6 +191,12 @@ interface ParcelSerializer {
}
}
// Write at least a nullability byte.
// We don't want parcel to be empty in case if all constructor parameters are objects
type.isNamedObject() -> NullAwareParcelSerializerWrapper(ObjectParcelSerializer(asmType, type, typeMapper))
type.isEnum() -> wrapToNullAwareIfNeeded(type, EnumParcelSerializer(asmType))
type.isSerializable() -> NullCompliantObjectParcelSerializer(asmType,
Method("writeSerializable", "(Ljava/io/Serializable;)V"),
Method("readSerializable", "()Ljava/io/Serializable;"))