K2: fix field annotation handling around serialization
#KT-57135 Fixed
This commit is contained in:
committed by
Space Team
parent
dc38ce24f7
commit
f6bf7560a6
+1
-1
@@ -331,7 +331,7 @@ class FirElementSerializer private constructor(
|
||||
var hasSetter = false
|
||||
|
||||
val hasAnnotations = property.nonSourceAnnotations(session).isNotEmpty()
|
||||
// TODO: hasAnnotations(descriptor) || hasAnnotations(descriptor.backingField) || hasAnnotations(descriptor.delegateField)
|
||||
|| property.backingField?.nonSourceAnnotations(session)?.isNotEmpty() == true
|
||||
|
||||
val modality = property.modality!!
|
||||
val defaultAccessorFlags = Flags.getAccessorFlags(
|
||||
|
||||
+3
-5
@@ -59,20 +59,18 @@ abstract class FirSerializerExtensionBase(
|
||||
versionRequirementTable: MutableVersionRequirementTable?,
|
||||
childSerializer: FirElementSerializer
|
||||
) {
|
||||
val regularPropertyAnnotations = mutableListOf<FirAnnotation>()
|
||||
val fieldPropertyAnnotations = mutableListOf<FirAnnotation>()
|
||||
val delegatePropertyAnnotations = mutableListOf<FirAnnotation>()
|
||||
|
||||
for (annotation in property.nonSourceAnnotations(session)) {
|
||||
for (annotation in property.backingField?.nonSourceAnnotations(session).orEmpty()) {
|
||||
val destination = when (annotation.useSiteTarget) {
|
||||
AnnotationUseSiteTarget.FIELD -> fieldPropertyAnnotations
|
||||
AnnotationUseSiteTarget.PROPERTY_DELEGATE_FIELD -> delegatePropertyAnnotations
|
||||
else -> regularPropertyAnnotations
|
||||
else -> fieldPropertyAnnotations
|
||||
}
|
||||
destination += annotation
|
||||
}
|
||||
|
||||
regularPropertyAnnotations.serializeAnnotations(proto, protocol.propertyAnnotation)
|
||||
property.nonSourceAnnotations(session).serializeAnnotations(proto, protocol.propertyAnnotation)
|
||||
fieldPropertyAnnotations.serializeAnnotations(proto, protocol.propertyBackingFieldAnnotation)
|
||||
delegatePropertyAnnotations.serializeAnnotations(proto, protocol.propertyDelegatedFieldAnnotation)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user