Configuration: Inline createDefaultArguments() methods
It's a superficial fix: the bug is actually caused by uninitialized companion instance reference in Kotlin2JvmCompilerArgumentsHolder class #KT-18505 Fixed
This commit is contained in:
+4
-5
@@ -21,8 +21,7 @@ import com.intellij.openapi.components.StoragePathMacros.PROJECT_CONFIG_DIR
|
|||||||
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters
|
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters
|
||||||
import com.intellij.util.xmlb.XmlSerializer
|
import com.intellij.util.xmlb.XmlSerializer
|
||||||
import org.jdom.Element
|
import org.jdom.Element
|
||||||
import org.jetbrains.kotlin.cli.common.arguments.collectFieldsToCopy
|
import org.jetbrains.kotlin.cli.common.arguments.*
|
||||||
import org.jetbrains.kotlin.cli.common.arguments.copyBean
|
|
||||||
import org.jetbrains.kotlin.config.SettingConstants
|
import org.jetbrains.kotlin.config.SettingConstants
|
||||||
|
|
||||||
abstract class BaseKotlinCompilerSettings<T : Any> protected constructor() : PersistentStateComponent<Element>, Cloneable {
|
abstract class BaseKotlinCompilerSettings<T : Any> protected constructor() : PersistentStateComponent<Element>, Cloneable {
|
||||||
@@ -67,9 +66,9 @@ abstract class BaseKotlinCompilerSettings<T : Any> protected constructor() : Per
|
|||||||
const val KOTLIN_COMPILER_SETTINGS_PATH = PROJECT_CONFIG_DIR + "/" + SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE
|
const val KOTLIN_COMPILER_SETTINGS_PATH = PROJECT_CONFIG_DIR + "/" + SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE
|
||||||
|
|
||||||
private val SKIP_DEFAULT_VALUES = SkipDefaultValuesSerializationFilters(
|
private val SKIP_DEFAULT_VALUES = SkipDefaultValuesSerializationFilters(
|
||||||
KotlinCommonCompilerArgumentsHolder.createDefaultArguments(),
|
CommonCompilerArguments.DummyImpl(),
|
||||||
Kotlin2JvmCompilerArgumentsHolder.createDefaultArguments(),
|
K2JVMCompilerArguments(),
|
||||||
Kotlin2JsCompilerArgumentsHolder.createDefaultArguments()
|
K2JSCompilerArguments()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.idea.compiler.configuration.BaseKotlinCompilerSettin
|
|||||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||||
Storage(file = KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED)))
|
Storage(file = KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED)))
|
||||||
class Kotlin2JsCompilerArgumentsHolder : BaseKotlinCompilerSettings<K2JSCompilerArguments>() {
|
class Kotlin2JsCompilerArgumentsHolder : BaseKotlinCompilerSettings<K2JSCompilerArguments>() {
|
||||||
override fun createSettings() = createDefaultArguments()
|
override fun createSettings() = K2JSCompilerArguments()
|
||||||
|
|
||||||
override fun validateNewSettings(settings: K2JSCompilerArguments) {
|
override fun validateNewSettings(settings: K2JSCompilerArguments) {
|
||||||
validateInheritedFieldsUnchanged(settings)
|
validateInheritedFieldsUnchanged(settings)
|
||||||
@@ -35,6 +35,5 @@ class Kotlin2JsCompilerArgumentsHolder : BaseKotlinCompilerSettings<K2JSCompiler
|
|||||||
companion object {
|
companion object {
|
||||||
fun getInstance(project: Project) = ServiceManager.getService(project, Kotlin2JsCompilerArgumentsHolder::class.java)!!
|
fun getInstance(project: Project) = ServiceManager.getService(project, Kotlin2JsCompilerArgumentsHolder::class.java)!!
|
||||||
|
|
||||||
fun createDefaultArguments(): K2JSCompilerArguments = K2JSCompilerArguments()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.idea.compiler.configuration.BaseKotlinCompilerSettin
|
|||||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||||
Storage(file = KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED)))
|
Storage(file = KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED)))
|
||||||
class Kotlin2JvmCompilerArgumentsHolder : BaseKotlinCompilerSettings<K2JVMCompilerArguments>() {
|
class Kotlin2JvmCompilerArgumentsHolder : BaseKotlinCompilerSettings<K2JVMCompilerArguments>() {
|
||||||
override fun createSettings() = createDefaultArguments()
|
override fun createSettings() = K2JVMCompilerArguments()
|
||||||
|
|
||||||
override fun validateNewSettings(settings: K2JVMCompilerArguments) {
|
override fun validateNewSettings(settings: K2JVMCompilerArguments) {
|
||||||
validateInheritedFieldsUnchanged(settings)
|
validateInheritedFieldsUnchanged(settings)
|
||||||
@@ -34,7 +34,5 @@ class Kotlin2JvmCompilerArgumentsHolder : BaseKotlinCompilerSettings<K2JVMCompil
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun getInstance(project: Project) = ServiceManager.getService(project, Kotlin2JvmCompilerArgumentsHolder::class.java)!!
|
fun getInstance(project: Project) = ServiceManager.getService(project, Kotlin2JvmCompilerArgumentsHolder::class.java)!!
|
||||||
|
|
||||||
fun createDefaultArguments(): K2JVMCompilerArguments = K2JVMCompilerArguments()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -55,14 +55,12 @@ class KotlinCommonCompilerArgumentsHolder : BaseKotlinCompilerSettings<CommonCom
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createSettings() = createDefaultArguments()
|
override fun createSettings() = CommonCompilerArguments.DummyImpl()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val DEFAULT_LANGUAGE_VERSION = LanguageVersion.LATEST_STABLE.versionString
|
private val DEFAULT_LANGUAGE_VERSION = LanguageVersion.LATEST_STABLE.versionString
|
||||||
|
|
||||||
fun getInstance(project: Project) =
|
fun getInstance(project: Project) =
|
||||||
ServiceManager.getService<KotlinCommonCompilerArgumentsHolder>(project, KotlinCommonCompilerArgumentsHolder::class.java)!!
|
ServiceManager.getService<KotlinCommonCompilerArgumentsHolder>(project, KotlinCommonCompilerArgumentsHolder::class.java)!!
|
||||||
|
|
||||||
fun createDefaultArguments(): CommonCompilerArguments = CommonCompilerArguments.DummyImpl()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user