From e752c1c3c7a777f58ed7b591eff592763016fb7e Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 25 Jul 2024 13:19:22 +0200 Subject: [PATCH] Revert "[kotlin] fix a case when a user enables and then disables K2 mode, IJ will stay in K2 mode after K2 mode is enabled by default" This reverts commit 50aa33bc89c923bb15e7689caf056509cfa9741f. To make it possible for KTIJ-30761 to enable K2 by default when it was not disabled by the user GitOrigin-RevId: abea9cdb2274b2439340a9d851c3b39a5a4f56bd --- .../ui/KotlinPluginKindSwitcherController.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/plugins/kotlin/preferences/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinPluginKindSwitcherController.kt b/plugins/kotlin/preferences/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinPluginKindSwitcherController.kt index 43adacc4cfaa..7b2d3058f8af 100644 --- a/plugins/kotlin/preferences/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinPluginKindSwitcherController.kt +++ b/plugins/kotlin/preferences/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinPluginKindSwitcherController.kt @@ -158,15 +158,11 @@ class KotlinPluginKindSwitcherController { const val USE_K2_PLUGIN_VM_OPTION_PREFIX: @NonNls String = "-D$USE_K2_PLUGIN_PROPERTY_NAME=" -private var useK2Plugin: Boolean - get() = VMOptions.readOption(USE_K2_PLUGIN_VM_OPTION_PREFIX, /*effective=*/ false)?.toBoolean() ?: false +private var useK2Plugin: Boolean? + get() = VMOptions.readOption(USE_K2_PLUGIN_VM_OPTION_PREFIX, /*effective=*/ false)?.toBoolean() set(value) { - if (value) { - VMOptions.setOption(USE_K2_PLUGIN_VM_OPTION_PREFIX, "true") - } else { - VMOptions.setOption(USE_K2_PLUGIN_VM_OPTION_PREFIX, null/*null means remove the value*/) - } + VMOptions.setOption(USE_K2_PLUGIN_VM_OPTION_PREFIX, value?.toString()) } private fun getPluginKindByVmOptions(): KotlinPluginMode = - KotlinPluginMode.of(useK2Plugin = useK2Plugin) + KotlinPluginMode.of(useK2Plugin = useK2Plugin == true)