Rename several core entities as a part of kx.serialization abi change

This commit is contained in:
Leonid Startsev
2020-06-19 19:11:24 +03:00
parent 5208bbcd21
commit 901d8f3e7a
4 changed files with 13 additions and 8 deletions
@@ -726,7 +726,7 @@ interface IrBuilderExtension {
private fun IrConstructor.isSerializationCtor(): Boolean {
val serialMarker =
compilerContext.referenceClass(SerializationPackages.packageFqName.child(SerialEntityNames.SERIAL_CTOR_MARKER_NAME))
compilerContext.referenceClass(SerializationPackages.internalPackageFqName.child(SerialEntityNames.SERIAL_CTOR_MARKER_NAME))
return valueParameters.lastOrNull()?.run {
name == SerialEntityNames.dummyParamName && type.classifierOrNull == serialMarker
@@ -126,7 +126,7 @@ internal fun InstructionAdapter.buildInternalConstructorDesc(
load(propVar, propertyType)
propVar += propertyType.size
}
constructorDesc.append("Lkotlinx/serialization/$SERIAL_CTOR_MARKER_NAME;)V")
constructorDesc.append("Lkotlinx/serialization/internal/$SERIAL_CTOR_MARKER_NAME;)V")
aconst(null)
return constructorDesc.toString()
}
@@ -373,7 +373,7 @@ internal fun AbstractSerialGenerator.stackValueSerializerInstance(codegen: Class
fun InstructionAdapter.wrapStackValueIntoNullableSerializer() =
invokestatic(
"kotlinx/serialization/internal/NullableSerializerKt", "makeNullable",
"kotlinx/serialization/builtins/BuiltinSerializersKt", "getNullable",
"(" + kSerializerType.descriptor + ")" + kSerializerType.descriptor, false
)
@@ -59,7 +59,7 @@ object SerialEntityNames {
const val SERIAL_LOADER_CLASS = "DeserializationStrategy"
const val SERIAL_DESCRIPTOR_CLASS = "SerialDescriptor"
const val SERIAL_DESCRIPTOR_CLASS_IMPL = "SerialClassDescImpl"
const val SERIAL_DESCRIPTOR_CLASS_IMPL = "PluginGeneratedSerialDescriptor"
const val SERIAL_DESCRIPTOR_FOR_ENUM = "EnumDescriptor"
//exceptions
@@ -1,6 +1,6 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlinx.serialization.compiler.resolve
@@ -23,7 +23,7 @@ internal fun ClassConstructorDescriptor.isSerializationCtor(): Boolean {
/*kind == CallableMemberDescriptor.Kind.SYNTHESIZED does not work because DeserializedClassConstructorDescriptor loses its kind*/
return valueParameters.lastOrNull()?.run {
name == SerialEntityNames.dummyParamName && type.constructor.declarationDescriptor?.classId == ClassId(
SerializationPackages.packageFqName,
SerializationPackages.internalPackageFqName,
SerialEntityNames.SERIAL_CTOR_MARKER_NAME
)
} == true
@@ -61,7 +61,12 @@ internal fun Annotations.findAnnotationKotlinTypeValue(
}
internal fun ClassDescriptor.getKSerializerConstructorMarker(): ClassDescriptor =
module.findClassAcrossModuleDependencies(ClassId(SerializationPackages.packageFqName, SerialEntityNames.SERIAL_CTOR_MARKER_NAME))!!
module.findClassAcrossModuleDependencies(
ClassId(
SerializationPackages.internalPackageFqName,
SerialEntityNames.SERIAL_CTOR_MARKER_NAME
)
)!!
internal fun getInternalPackageFqn(classSimpleName: String): FqName =
SerializationPackages.internalPackageFqName.child(Name.identifier(classSimpleName))