CLI: drop CommonCompilerArguments.createDefaultInstance
Move the corresponding default value initializers to the field declarations
This commit is contained in:
+5
-4
@@ -21,7 +21,8 @@ import com.intellij.openapi.components.StoragePathMacros.PROJECT_CONFIG_DIR
|
||||
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters
|
||||
import com.intellij.util.xmlb.XmlSerializer
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.kotlin.cli.common.arguments.*
|
||||
import org.jetbrains.kotlin.cli.common.arguments.collectFieldsToCopy
|
||||
import org.jetbrains.kotlin.cli.common.arguments.copyBean
|
||||
import org.jetbrains.kotlin.config.SettingConstants
|
||||
|
||||
abstract class BaseKotlinCompilerSettings<T : Any> protected constructor() : PersistentStateComponent<Element>, Cloneable {
|
||||
@@ -66,9 +67,9 @@ abstract class BaseKotlinCompilerSettings<T : Any> protected constructor() : Per
|
||||
const val KOTLIN_COMPILER_SETTINGS_PATH = PROJECT_CONFIG_DIR + "/" + SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE
|
||||
|
||||
private val SKIP_DEFAULT_VALUES = SkipDefaultValuesSerializationFilters(
|
||||
CommonCompilerArguments.createDefaultInstance(),
|
||||
K2JVMCompilerArguments.createDefaultInstance(),
|
||||
K2JSCompilerArguments.createDefaultInstance()
|
||||
KotlinCommonCompilerArgumentsHolder.createDefaultArguments(),
|
||||
Kotlin2JvmCompilerArgumentsHolder.createDefaultArguments(),
|
||||
Kotlin2JsCompilerArgumentsHolder.createDefaultArguments()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.idea.compiler.configuration.BaseKotlinCompilerSettin
|
||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
Storage(file = KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED)))
|
||||
class Kotlin2JsCompilerArgumentsHolder : BaseKotlinCompilerSettings<K2JSCompilerArguments>() {
|
||||
override fun createSettings() = K2JSCompilerArguments.createDefaultInstance()
|
||||
override fun createSettings() = createDefaultArguments()
|
||||
|
||||
override fun validateNewSettings(settings: K2JSCompilerArguments) {
|
||||
validateInheritedFieldsUnchanged(settings)
|
||||
@@ -34,5 +34,7 @@ class Kotlin2JsCompilerArgumentsHolder : BaseKotlinCompilerSettings<K2JSCompiler
|
||||
|
||||
companion object {
|
||||
fun getInstance(project: Project) = ServiceManager.getService(project, Kotlin2JsCompilerArgumentsHolder::class.java)!!
|
||||
|
||||
fun createDefaultArguments(): K2JSCompilerArguments = K2JSCompilerArguments()
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.idea.compiler.configuration
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
|
||||
import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.BaseKotlinCompilerSettings.Companion.KOTLIN_COMPILER_SETTINGS_PATH
|
||||
|
||||
@@ -27,7 +26,7 @@ import org.jetbrains.kotlin.idea.compiler.configuration.BaseKotlinCompilerSettin
|
||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
Storage(file = KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED)))
|
||||
class Kotlin2JvmCompilerArgumentsHolder : BaseKotlinCompilerSettings<K2JVMCompilerArguments>() {
|
||||
override fun createSettings() = K2JVMCompilerArguments.createDefaultInstance()
|
||||
override fun createSettings() = createDefaultArguments()
|
||||
|
||||
override fun validateNewSettings(settings: K2JVMCompilerArguments) {
|
||||
validateInheritedFieldsUnchanged(settings)
|
||||
@@ -35,5 +34,7 @@ class Kotlin2JvmCompilerArgumentsHolder : BaseKotlinCompilerSettings<K2JVMCompil
|
||||
|
||||
companion object {
|
||||
fun getInstance(project: Project) = ServiceManager.getService(project, Kotlin2JvmCompilerArgumentsHolder::class.java)!!
|
||||
|
||||
fun createDefaultArguments(): K2JVMCompilerArguments = K2JVMCompilerArguments()
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -55,12 +55,14 @@ class KotlinCommonCompilerArgumentsHolder : BaseKotlinCompilerSettings<CommonCom
|
||||
}
|
||||
}
|
||||
|
||||
override fun createSettings() = CommonCompilerArguments.createDefaultInstance()
|
||||
override fun createSettings() = createDefaultArguments()
|
||||
|
||||
companion object {
|
||||
private val DEFAULT_LANGUAGE_VERSION = LanguageVersion.LATEST_STABLE.versionString
|
||||
|
||||
fun getInstance(project: Project) =
|
||||
ServiceManager.getService<KotlinCommonCompilerArgumentsHolder>(project, KotlinCommonCompilerArgumentsHolder::class.java)!!
|
||||
|
||||
fun createDefaultArguments(): CommonCompilerArguments = CommonCompilerArguments.DummyImpl()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user