diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt index 893fb7f04bb..915b26facc3 100644 --- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt +++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt @@ -158,7 +158,7 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_ ?.configurationElement?.let { getCompilerArgumentsByConfigurationElement(it, configuredPlatform) } parseCompilerArgumentsToFacet(sharedArguments, emptyList(), kotlinFacet) if (executionArguments != null) { - parseCompilerArgumentsToFacet(executionArguments, emptyList(), kotlinFacet, true) + parseCompilerArgumentsToFacet(executionArguments, emptyList(), kotlinFacet) } MavenProjectImportHandler.getInstances(module.project).forEach { it(kotlinFacet, mavenProject) } } diff --git a/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt b/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt index f7994a0bf01..383e3ecd3c5 100644 --- a/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt +++ b/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt @@ -588,7 +588,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() { Assert.assertEquals("enable", compilerInfo.coroutineSupport.compilerArgument) Assert.assertEquals("JVM 1.8", versionInfo.targetPlatformKind!!.description) Assert.assertEquals("1.8", compilerInfo.k2jvmCompilerArguments!!.jvmTarget) - Assert.assertEquals("-version -cp foobar.jar -jdk-home JDK_HOME -Xmulti-platform", + Assert.assertEquals("-cp foobar.jar -jdk-home JDK_HOME -Xmulti-platform", compilerInfo.compilerSettings!!.additionalArguments) } } diff --git a/idea/src/org/jetbrains/kotlin/idea/facet/facetUtils.kt b/idea/src/org/jetbrains/kotlin/idea/facet/facetUtils.kt index 546b752dfe1..6c62c7a10b7 100644 --- a/idea/src/org/jetbrains/kotlin/idea/facet/facetUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/facet/facetUtils.kt @@ -156,12 +156,7 @@ private val CommonCompilerArguments.exposedFields: List else -> commonExposedFields } -fun parseCompilerArgumentsToFacet( - arguments: List, - defaultArguments: List, - kotlinFacet: KotlinFacet, - appendAdditionalArguments: Boolean = false -) { +fun parseCompilerArgumentsToFacet(arguments: List, defaultArguments: List, kotlinFacet: KotlinFacet) { val argumentArray = arguments.toTypedArray() with(kotlinFacet.configuration.settings) { @@ -216,14 +211,8 @@ fun parseCompilerArgumentsToFacet( copyFieldsSatisfying(compilerArguments, this, ::exposeAsAdditionalArgument) ArgumentUtils.convertArgumentsToStringList(this).joinToString(separator = " ") } - - val newAdditionalArguments = if (additionalArgumentsString.isNotEmpty()) additionalArgumentsString else CompilerSettings.DEFAULT_ADDITIONAL_ARGUMENTS - if (appendAdditionalArguments) { - compilerInfo.compilerSettings!!.additionalArguments += " $newAdditionalArguments" - } - else { - compilerInfo.compilerSettings!!.additionalArguments = newAdditionalArguments - } + compilerInfo.compilerSettings!!.additionalArguments = + if (additionalArgumentsString.isNotEmpty()) additionalArgumentsString else CompilerSettings.DEFAULT_ADDITIONAL_ARGUMENTS with(compilerArguments.javaClass.newInstance()) { copyFieldsSatisfying(this, compilerArguments, ::exposeAsAdditionalArgument)