diff --git a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmClassCodegen.kt b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmClassCodegen.kt index f07141b2acc..284360e998e 100644 --- a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmClassCodegen.kt +++ b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmClassCodegen.kt @@ -192,6 +192,9 @@ class FirJvmClassCodegen( } override fun bindFieldMetadata(field: IrField, fieldType: Type, fieldName: String) { - // TODO + val metadata = field.metadata + if (metadata is FirMetadataSource.Property) { + state.globalSerializationBindings.put(FirJvmSerializerExtension.FIELD_FOR_PROPERTY, metadata.property, fieldType to fieldName) + } } } \ No newline at end of file diff --git a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmSerializerExtension.kt b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmSerializerExtension.kt index 37b1e548680..bee9b8bc910 100644 --- a/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmSerializerExtension.kt +++ b/compiler/fir/fir2ir/jvm-backend/src/org/jetbrains/kotlin/fir/backend/jvm/FirJvmSerializerExtension.kt @@ -247,14 +247,13 @@ class FirJvmSerializerExtension @JvmOverloads constructor( val getterMethod = if (getter == null) null else getBinding(METHOD_FOR_FIR_FUNCTION, getter) val setterMethod = if (setter == null) null else getBinding(METHOD_FOR_FIR_FUNCTION, setter) - // TODO: FIR field metadata - //val field = getBinding(JvmSerializationBindings.FIELD_FOR_PROPERTY, property) + val field = getBinding(FIELD_FOR_PROPERTY, property) val syntheticMethod = getBinding(SYNTHETIC_METHOD_FOR_FIR_VARIABLE, property) val signature = signatureSerializer.propertySignature( property, - null, //field?.second, - null, //field?.first?.descriptor, + field?.second, + field?.first?.descriptor, if (syntheticMethod != null) signatureSerializer.methodSignature(null, syntheticMethod) else null, if (getterMethod != null) signatureSerializer.methodSignature(null, getterMethod) else null, if (setterMethod != null) signatureSerializer.methodSignature(null, setterMethod) else null @@ -399,7 +398,7 @@ class FirJvmSerializerExtension @JvmOverloads constructor( companion object { val METHOD_FOR_FIR_FUNCTION = JvmSerializationBindings.SerializationMappingSlice.create, Method>() - + val FIELD_FOR_PROPERTY = JvmSerializationBindings.SerializationMappingSlice.create>() val SYNTHETIC_METHOD_FOR_FIR_VARIABLE = JvmSerializationBindings.SerializationMappingSlice.create, Method>() } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index 952a8b6a244..8e60d909fdf 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -629,6 +629,8 @@ class Fir2IrDeclarationStorage( if (!isFakeOverride && thisReceiverOwner != null) { it.populateOverriddenSymbols(thisReceiverOwner) } + }.apply { + metadata = FirMetadataSource.Property(property, descriptor) } } } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/FirMetadataSource.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/FirMetadataSource.kt index bdfc2b77776..e20ec5fe56b 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/FirMetadataSource.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/FirMetadataSource.kt @@ -35,6 +35,13 @@ interface FirMetadataSource : MetadataSource { get() = function.session } + class Property( + val property: FirProperty, descriptor: PropertyDescriptor + ) : MetadataSource.Property(descriptor), FirMetadataSource { + override val session: FirSession + get() = property.session + } + class Variable( val variable: FirVariable<*>, descriptor: PropertyDescriptor diff --git a/compiler/testData/codegen/box/jvmField/topLevelFieldReflection.kt b/compiler/testData/codegen/box/jvmField/topLevelFieldReflection.kt index af03afe88a6..ec6662cb63c 100644 --- a/compiler/testData/codegen/box/jvmField/topLevelFieldReflection.kt +++ b/compiler/testData/codegen/box/jvmField/topLevelFieldReflection.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/multifileClasses/constPropertyReferenceFromMultifileClass.kt b/compiler/testData/codegen/box/multifileClasses/constPropertyReferenceFromMultifileClass.kt index 56ed146cf12..95b5b84301c 100644 --- a/compiler/testData/codegen/box/multifileClasses/constPropertyReferenceFromMultifileClass.kt +++ b/compiler/testData/codegen/box/multifileClasses/constPropertyReferenceFromMultifileClass.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT // FILE: 1.kt diff --git a/compiler/testData/codegen/box/reflection/call/incorrectNumberOfArguments.kt b/compiler/testData/codegen/box/reflection/call/incorrectNumberOfArguments.kt index a6171ed1ac1..dc320ff584d 100644 --- a/compiler/testData/codegen/box/reflection/call/incorrectNumberOfArguments.kt +++ b/compiler/testData/codegen/box/reflection/call/incorrectNumberOfArguments.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +FunctionReferenceWithDefaultValueAsOtherType -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt b/compiler/testData/codegen/box/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt index a916cebc64b..b23c3b6ecf5 100644 --- a/compiler/testData/codegen/box/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt +++ b/compiler/testData/codegen/box/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/mapping/inlineClassPrimaryVal.kt b/compiler/testData/codegen/box/reflection/mapping/inlineClassPrimaryVal.kt index 5168d57e031..a2d1188816d 100644 --- a/compiler/testData/codegen/box/reflection/mapping/inlineClassPrimaryVal.kt +++ b/compiler/testData/codegen/box/reflection/mapping/inlineClassPrimaryVal.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/mapping/memberProperty.kt b/compiler/testData/codegen/box/reflection/mapping/memberProperty.kt index 6abdd502b46..0e649cac2de 100644 --- a/compiler/testData/codegen/box/reflection/mapping/memberProperty.kt +++ b/compiler/testData/codegen/box/reflection/mapping/memberProperty.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/mapping/privateProperty.kt b/compiler/testData/codegen/box/reflection/mapping/privateProperty.kt index 91980480f53..dc78aa2bd99 100644 --- a/compiler/testData/codegen/box/reflection/mapping/privateProperty.kt +++ b/compiler/testData/codegen/box/reflection/mapping/privateProperty.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/mapping/types/parameterizedTypes.kt b/compiler/testData/codegen/box/reflection/mapping/types/parameterizedTypes.kt index d0e56a48426..6de22dacd2f 100644 --- a/compiler/testData/codegen/box/reflection/mapping/types/parameterizedTypes.kt +++ b/compiler/testData/codegen/box/reflection/mapping/types/parameterizedTypes.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT // FULL_JDK diff --git a/compiler/testData/codegen/box/reflection/mapping/types/propertyAccessors.kt b/compiler/testData/codegen/box/reflection/mapping/types/propertyAccessors.kt index d21326614a6..3d7098dc085 100644 --- a/compiler/testData/codegen/box/reflection/mapping/types/propertyAccessors.kt +++ b/compiler/testData/codegen/box/reflection/mapping/types/propertyAccessors.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/multifileClasses/javaFieldForVarAndConstVal.kt b/compiler/testData/codegen/box/reflection/multifileClasses/javaFieldForVarAndConstVal.kt index d141dbcd8d7..cb55a8c6e92 100644 --- a/compiler/testData/codegen/box/reflection/multifileClasses/javaFieldForVarAndConstVal.kt +++ b/compiler/testData/codegen/box/reflection/multifileClasses/javaFieldForVarAndConstVal.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/callPrivatePropertyFromGetProperties.kt b/compiler/testData/codegen/box/reflection/properties/callPrivatePropertyFromGetProperties.kt index ecba805bc10..6d501894e6e 100644 --- a/compiler/testData/codegen/box/reflection/properties/callPrivatePropertyFromGetProperties.kt +++ b/compiler/testData/codegen/box/reflection/properties/callPrivatePropertyFromGetProperties.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/booleanPropertyNameStartsWithIs.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/booleanPropertyNameStartsWithIs.kt index c5214be8c5c..bd50b053c4b 100644 --- a/compiler/testData/codegen/box/reflection/properties/getDelegate/booleanPropertyNameStartsWithIs.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/booleanPropertyNameStartsWithIs.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/boundExtensionProperty.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/boundExtensionProperty.kt index 1c82f014d45..ce58b02ff28 100644 --- a/compiler/testData/codegen/box/reflection/properties/getDelegate/boundExtensionProperty.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/boundExtensionProperty.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/boundMemberProperty.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/boundMemberProperty.kt index 33116c5dd02..9e8b6dbbc18 100644 --- a/compiler/testData/codegen/box/reflection/properties/getDelegate/boundMemberProperty.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/boundMemberProperty.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/extensionProperty.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/extensionProperty.kt index 769c2fc948e..7289f71d279 100644 --- a/compiler/testData/codegen/box/reflection/properties/getDelegate/extensionProperty.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/extensionProperty.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/getExtensionDelegate.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/getExtensionDelegate.kt index e07373885f2..82f8e2b3c04 100644 --- a/compiler/testData/codegen/box/reflection/properties/getDelegate/getExtensionDelegate.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/getExtensionDelegate.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/kPropertyForDelegatedProperty.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/kPropertyForDelegatedProperty.kt index c277400afc0..812fb5c1c1f 100644 --- a/compiler/testData/codegen/box/reflection/properties/getDelegate/kPropertyForDelegatedProperty.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/kPropertyForDelegatedProperty.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/memberProperty.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/memberProperty.kt index 8dc4392a40b..c00d4580c2f 100644 --- a/compiler/testData/codegen/box/reflection/properties/getDelegate/memberProperty.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/memberProperty.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashClassAndCompanion.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashClassAndCompanion.kt index 64c887f350d..e6b948f9615 100644 --- a/compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashClassAndCompanion.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashClassAndCompanion.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashExtensionProperties.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashExtensionProperties.kt index e76f7bdd324..b66b174c18c 100644 --- a/compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashExtensionProperties.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashExtensionProperties.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/noSetAccessibleTrue.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/noSetAccessibleTrue.kt index 153a2ef658c..9b7a170c2c0 100644 --- a/compiler/testData/codegen/box/reflection/properties/getDelegate/noSetAccessibleTrue.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/noSetAccessibleTrue.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/overrideDelegatedByDelegated.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/overrideDelegatedByDelegated.kt index 34c36a4e899..f263ec2a738 100644 --- a/compiler/testData/codegen/box/reflection/properties/getDelegate/overrideDelegatedByDelegated.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/overrideDelegatedByDelegated.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt index 328453d3dde..140a97f9e23 100644 --- a/compiler/testData/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/privateClassVal.kt b/compiler/testData/codegen/box/reflection/properties/privateClassVal.kt index 05e371a7279..c04763ecaa4 100644 --- a/compiler/testData/codegen/box/reflection/properties/privateClassVal.kt +++ b/compiler/testData/codegen/box/reflection/properties/privateClassVal.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/privateClassVar.kt b/compiler/testData/codegen/box/reflection/properties/privateClassVar.kt index bd0787e9f2d..a117ada322b 100644 --- a/compiler/testData/codegen/box/reflection/properties/privateClassVar.kt +++ b/compiler/testData/codegen/box/reflection/properties/privateClassVar.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/properties/privateJvmStaticVarInObject.kt b/compiler/testData/codegen/box/reflection/properties/privateJvmStaticVarInObject.kt index cd0fd3a98e1..2c3622c5bfe 100644 --- a/compiler/testData/codegen/box/reflection/properties/privateJvmStaticVarInObject.kt +++ b/compiler/testData/codegen/box/reflection/properties/privateJvmStaticVarInObject.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT