Remove non-type annotations from type serializer analysis
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/450
This commit is contained in:
+3
-3
@@ -83,7 +83,7 @@ fun AbstractSerialGenerator.getSerialTypeInfo(property: SerializableProperty): S
|
||||
}
|
||||
else -> {
|
||||
val serializer =
|
||||
findTypeSerializerOrContext(property.module, property.type, property.descriptor.annotations, property.descriptor.findPsi())
|
||||
findTypeSerializerOrContext(property.module, property.type, property.descriptor.findPsi())
|
||||
SerializableInfo(serializer)
|
||||
}
|
||||
}
|
||||
@@ -108,11 +108,11 @@ fun analyzeSpecialSerializers(
|
||||
fun AbstractSerialGenerator.findTypeSerializerOrContext(
|
||||
module: ModuleDescriptor,
|
||||
kType: KotlinType,
|
||||
annotations: Annotations = kType.annotations,
|
||||
sourceElement: PsiElement? = null
|
||||
): ClassDescriptor? {
|
||||
val annotations = kType.annotations
|
||||
if (kType.isTypeParameter()) return null
|
||||
if (kType.isMarkedNullable) return findTypeSerializerOrContext(module, kType.makeNotNullable(), annotations, sourceElement)
|
||||
if (kType.isMarkedNullable) return findTypeSerializerOrContext(module, kType.makeNotNullable(), sourceElement)
|
||||
annotations.serializableWith(module)?.let { return it.toClassDescriptor }
|
||||
additionalSerializersInScopeOfCurrentFile[kType]?.let { return it }
|
||||
if (kType in contextualKClassListInCurrentFile) return module.getClassFromSerializationPackage(SpecialBuiltins.contextSerializer)
|
||||
|
||||
-1
@@ -451,7 +451,6 @@ interface IrBuilderExtension {
|
||||
?: if (!property.type.isTypeParameter()) generator.findTypeSerializerOrContext(
|
||||
property.module,
|
||||
property.type,
|
||||
property.descriptor.annotations,
|
||||
property.descriptor.findPsi()
|
||||
) else null
|
||||
return serializerInstance(
|
||||
|
||||
-1
@@ -124,7 +124,6 @@ internal fun SerializerJsTranslator.serializerTower(property: SerializableProper
|
||||
?: if (!property.type.isTypeParameter()) findTypeSerializerOrContext(
|
||||
property.module,
|
||||
property.type,
|
||||
property.descriptor.annotations,
|
||||
property.descriptor.findPsi()
|
||||
) else null
|
||||
return serializerInstance(serializer, property.module, property.type, property.genericIndex)
|
||||
|
||||
-2
@@ -191,7 +191,6 @@ internal fun InstructionAdapter.stackValueSerializerInstanceFromSerializerWithou
|
||||
?: if (!property.type.isTypeParameter()) serializerCodegen.findTypeSerializerOrContext(
|
||||
property.module,
|
||||
property.type,
|
||||
property.descriptor.annotations,
|
||||
property.descriptor.findPsi()
|
||||
) else null
|
||||
return serializerCodegen.stackValueSerializerInstance(
|
||||
@@ -382,7 +381,6 @@ fun AbstractSerialGenerator.getSerialTypeInfo(property: SerializableProperty, ty
|
||||
?: findTypeSerializerOrContext(
|
||||
property.module,
|
||||
property.type,
|
||||
property.descriptor.annotations,
|
||||
property.descriptor.findPsi()
|
||||
)
|
||||
return JVMSerialTypeInfo(
|
||||
|
||||
Reference in New Issue
Block a user