diff --git a/compiler/plugin-api/src/org/jetbrains/kotlin/compiler/plugin/CommandLineProcessor.kt b/compiler/plugin-api/src/org/jetbrains/kotlin/compiler/plugin/CommandLineProcessor.kt index 82bd2f02474..b1bb3b94b7a 100644 --- a/compiler/plugin-api/src/org/jetbrains/kotlin/compiler/plugin/CommandLineProcessor.kt +++ b/compiler/plugin-api/src/org/jetbrains/kotlin/compiler/plugin/CommandLineProcessor.kt @@ -35,13 +35,13 @@ interface CommandLineProcessor { fun processOption(option: CliOption, value: String, configuration: CompilerConfiguration) {} fun CompilerConfiguration.appendList(option: CompilerConfigurationKey>, value: T) { - val paths = getList(option).toMutableList() + val paths = getList(option).asMutableList() paths.add(value) put(option, paths) } fun CompilerConfiguration.appendList(option: CompilerConfigurationKey>, values: List) { - val paths = getList(option).toMutableList() + val paths = getList(option).asMutableList() paths.addAll(values) put(option, paths) } @@ -55,4 +55,12 @@ interface CommandLineProcessor { } } } + + private fun List.asMutableList(): MutableList { + if (this is ArrayList) { + return this + } + + return this.toMutableList() + } } \ No newline at end of file