Repository: JetBrains/kotlin
File: plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt (Kotlin)

Code before:
    }

    companion object {
        fun checkCompilerConfiguration(configuration: CompilerConfiguration): Boolean {
            val msgCollector = configuration.messageCollector
            val suppressKotlinVersionCheck = configuration.get(ComposeConfiguration.SUPPRESS_KOTLIN_VERSION_COMPATIBILITY_CHECK)
            if (suppressKotlinVersionCheck != null) {
                msgCollector.report(
                    CompilerMessageSeverity.WARNING,
                    "suppressKotlinVersionCompatibilityCheck flag is deprecated for Compose compiler bundled with Kotlin releases."
                )
            }

            val decoysEnabled =
                configuration.get(ComposeConfiguration.DECOYS_ENABLED_KEY, false)
            if (decoysEnabled) {
                msgCollector.report(
                    CompilerMessageSeverity.ERROR,
                    "Decoys generation is no longer supported by the Compose compiler."
                )
                return false
            }
            return true
        }

        fun updateConfigurationCommon(configuration: CompilerConfiguration) {
            configuration.put(
                JVMConfigurationKeys.IGNORED_ANNOTATIONS_FOR_BRIDGES,
                listOf(
                    "androidx.compose.runtime.Composable",
                    "androidx.compose.runtime.ComposableTargetMarker",
                    "androidx.compose.runtime.internal.FunctionKeyMeta",
                )
            )
        }

        fun ExtensionStorage.registerCommonExtensions(
            composeDescriptorSerializerContext: ComposeDescriptorSerializerContext? = null,
        ) {
            StorageComponentContainerContributor.registerExtension(
                ComposableCallChecker()
            )
            StorageComponentContainerContributor.registerExtension(
                ComposableDeclarationChecker()
            )
            StorageComponentContainerContributor.registerExtension(
                ComposableTargetChecker()
            )
            StorageComponentContainerContributor.registerExtension(
                ComposableAnnotationChecker()
            )

Review comment (suggestion):
I am not sure `updateConfigurationCommon` is the best name here as it only updates JVM-specific configuration with one specific flag. Consider renaming to something like `CompilerConfiguration.ignoreComposeAnnotationsOnJvmBridges`.

Code after:
    }

    companion object {
        fun checkCompilerConfiguration(configuration: CompilerConfiguration): Boolean {
            val msgCollector = configuration.messageCollector
            val suppressKotlinVersionCheck = configuration.get(ComposeConfiguration.SUPPRESS_KOTLIN_VERSION_COMPATIBILITY_CHECK)
            if (suppressKotlinVersionCheck != null) {
                msgCollector.report(
                    CompilerMessageSeverity.WARNING,
                    "suppressKotlinVersionCompatibilityCheck flag is deprecated for Compose compiler bundled with Kotlin releases."
                )
            }

            val decoysEnabled =
                configuration.get(ComposeConfiguration.DECOYS_ENABLED_KEY, false)
            if (decoysEnabled) {
                msgCollector.report(
                    CompilerMessageSeverity.ERROR,
                    "Decoys generation is no longer supported by the Compose compiler."
                )
                return false
            }
            return true
        }

        fun setupJvmConfiguration(configuration: CompilerConfiguration) {
            configuration.put(
                JVMConfigurationKeys.IGNORED_ANNOTATIONS_FOR_BRIDGES,
                listOf(
                    ComposeClassIds.Composable.asFqNameString(),
                    ComposeClassIds.ComposableInferredTarget.asFqNameString(),
                    ComposeClassIds.FunctionKeyMeta.asFqNameString(),
                )
            )
        }

        fun ExtensionStorage.registerCommonExtensions(
            composeDescriptorSerializerContext: ComposeDescriptorSerializerContext? = null,
        ) {
            StorageComponentContainerContributor.registerExtension(
                ComposableCallChecker()
            )
            StorageComponentContainerContributor.registerExtension(
                ComposableDeclarationChecker()
            )
            StorageComponentContainerContributor.registerExtension(
                ComposableTargetChecker()
            )
            StorageComponentContainerContributor.registerExtension(
                ComposableAnnotationChecker()
            )