diff --git a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt index 6992ea7fe5a..c02d5c9845b 100644 --- a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt +++ b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt @@ -116,7 +116,7 @@ open class JvmIrCodegenFactory( val irProviders: List, val extensions: JvmGeneratorExtensions, val backendExtension: JvmBackendExtension, - val pluginContext: IrPluginContext, + val pluginContext: IrPluginContext?, val notifyCodegenStart: () -> Unit ) : CodegenFactory.BackendInput @@ -212,8 +212,8 @@ open class JvmIrCodegenFactory( psi2irContext.irBuiltIns, irLinker, messageLogger - ) - if (pluginExtensions.isNotEmpty() && !ideCodegenSettings.shouldStubAndNotLinkUnboundSymbols) { + ).takeIf { !ideCodegenSettings.shouldStubAndNotLinkUnboundSymbols } + if (pluginExtensions.isNotEmpty() && pluginContext != null) { for (extension in pluginExtensions) { if (psi2irContext.configuration.generateBodies || @OptIn(FirIncompatiblePluginAPI::class) extension.shouldAlsoBeAppliedInKaptStubGenerationMode diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/ir/IrBackendInput.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/ir/IrBackendInput.kt index 8b8f1985acd..0ca974a6999 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/ir/IrBackendInput.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/ir/IrBackendInput.kt @@ -115,7 +115,7 @@ sealed class IrBackendInput : ResultingArtifact.BackendInput() { get() = backendInput.irModuleFragment override val irPluginContext: IrPluginContext - get() = backendInput.pluginContext + get() = backendInput.pluginContext!! override val diagnosticReporter: BaseDiagnosticsCollector get() = state.diagnosticReporter as BaseDiagnosticsCollector