JVM IR: do not serialize metadata for actualized optional expectations
Optional-expectation annotations which have an actual counterpart should have never been serialized to the kotlin_module's proto. See for example the original (correct) implementation in the old JVM backend in `PackageCodegenImpl.addDescriptorToOptionalAnnotationsIfNeeded`. #KT-55611 Fixed
This commit is contained in:
committed by
Space Team
parent
11504fda18
commit
7a9c59aeb5
+2
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.backend.jvm.ir.isOptionalAnnotationClass
|
||||
import org.jetbrains.kotlin.ir.declarations.DescriptorMetadataSource
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.OptionalAnnotationUtil
|
||||
|
||||
internal val processOptionalAnnotationsPhase = makeIrModulePhase(
|
||||
::ProcessOptionalAnnotations,
|
||||
@@ -30,6 +31,7 @@ class ProcessOptionalAnnotations(private val context: JvmBackendContext) : FileL
|
||||
private fun IrClass.registerOptionalAnnotations() {
|
||||
// TODO FirMetadataSource.Class
|
||||
val metadataSource = (metadata as? DescriptorMetadataSource.Class)?.descriptor ?: return
|
||||
if (!OptionalAnnotationUtil.shouldGenerateExpectClass(metadataSource)) return
|
||||
context.state.factory.packagePartRegistry.optionalAnnotations += metadataSource
|
||||
|
||||
declarations.forEach {
|
||||
|
||||
Reference in New Issue
Block a user