Parcelable: newArray() result type should be Object[] (KT-20717)

This commit is contained in:
Yan Zhulanow
2017-10-18 23:49:30 +03:00
parent 26005751d8
commit e28cffd0ad
19 changed files with 53 additions and 22 deletions
@@ -296,7 +296,7 @@ open class ParcelableCodegenExtension : ExpressionCodegenExtension {
val parcelableAsmType = codegen.typeMapper.mapType(parcelableClass)
createMethod(creatorClass, NEW_ARRAY,
builtIns.getArrayType(Variance.INVARIANT, parcelableClass.defaultType),
builtIns.getArrayType(Variance.INVARIANT, builtIns.anyType),
"size" to builtIns.intType
).write(codegen) {
if (parcelerObject != null) {
@@ -315,8 +315,8 @@ open class ParcelableCodegenExtension : ExpressionCodegenExtension {
v.getstatic(containerAsmType.internalName, companionFieldName, companionAsmType.descriptor)
v.load(1, Type.INT_TYPE)
v.invokevirtual(companionAsmType.internalName, "newArray", "(I)[${containerAsmType.descriptor}", false)
v.areturn(Type.getType("[L$parcelableAsmType;"))
v.invokevirtual(companionAsmType.internalName, "newArray", "(I)[Ljava/lang/Object;", false)
v.areturn(Type.getType("[Ljava/lang/Object;"))
return@write
}