From a441a82357270f793dac3a378505c6c6993c44be Mon Sep 17 00:00:00 2001 From: Ivan Kylchik Date: Mon, 18 Dec 2023 18:59:03 +0100 Subject: [PATCH] [JVM_IR] Add some documentation to the `IdeCodegenSettings` class #KT-64238 Fixed --- .../kotlin/backend/jvm/JvmIrCodegenFactory.kt | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) 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 acc5ee31ebe..e0600a0676c 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 @@ -87,19 +87,17 @@ open class JvmIrCodegenFactory( IdeCodegenSettings(shouldStubAndNotLinkUnboundSymbols = shouldStubAndNotLinkUnboundSymbols), ) - init { - if (ideCodegenSettings.shouldDeduplicateBuiltInSymbols && !ideCodegenSettings.shouldStubAndNotLinkUnboundSymbols) { - throw IllegalStateException( - "`shouldDeduplicateBuiltInSymbols` depends on `shouldStubAndNotLinkUnboundSymbols` being enabled. Deduplication of" + - " built-in symbols hasn't been tested without stubbing and there is currently no use case for it without stubbing." - ) - } - } - /** + * @param shouldStubAndNotLinkUnboundSymbols + * must be `true` only if current compilation is done in the context of the "Evaluate Expression" + * process in the debugger or "Android LiveEdit plugin". + * When enabled, this option disables the linkage process and generates stubs for all unbound symbols. * @param shouldStubOrphanedExpectSymbols See [stubOrphanedExpectSymbols]. * @param shouldReferenceUndiscoveredExpectSymbols See [referenceUndiscoveredExpectSymbols]. * @param shouldDeduplicateBuiltInSymbols See [SymbolTableWithBuiltInsDeduplication]. + * @param doNotLoadDependencyModuleHeaders + * must be `true` only if current compilation is done in the context of the "Evaluate Expression" process in the debugger. + * When enabled, this option disables all compiler plugins. */ data class IdeCodegenSettings( val shouldStubAndNotLinkUnboundSymbols: Boolean = false, @@ -107,7 +105,16 @@ open class JvmIrCodegenFactory( val shouldReferenceUndiscoveredExpectSymbols: Boolean = false, val shouldDeduplicateBuiltInSymbols: Boolean = false, val doNotLoadDependencyModuleHeaders: Boolean = false, - ) + ) { + init { + if (shouldDeduplicateBuiltInSymbols && !shouldStubAndNotLinkUnboundSymbols) { + throw IllegalStateException( + "`shouldDeduplicateBuiltInSymbols` depends on `shouldStubAndNotLinkUnboundSymbols` being enabled. Deduplication of" + + " built-in symbols hasn't been tested without stubbing and there is currently no use case for it without stubbing." + ) + } + } + } data class JvmIrBackendInput( val irModuleFragment: IrModuleFragment,