Minor, change parameter type of parseCommandLineArguments
This commit is contained in:
+1
-2
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.cli.common.arguments
|
||||
|
||||
import com.intellij.util.SmartList
|
||||
import java.lang.reflect.Field
|
||||
import java.util.*
|
||||
|
||||
annotation class Argument(
|
||||
val value: String,
|
||||
@@ -54,7 +53,7 @@ data class ArgumentParseErrors(
|
||||
)
|
||||
|
||||
// Parses arguments into the passed [result] object. Errors related to the parsing will be collected into [CommonToolArguments.errors].
|
||||
fun <A : CommonToolArguments> parseCommandLineArguments(args: Array<out String>, result: A) {
|
||||
fun <A : CommonToolArguments> parseCommandLineArguments(args: List<String>, result: A) {
|
||||
data class ArgumentField(val field: Field, val argument: Argument)
|
||||
|
||||
val fields = result::class.java.fields.mapNotNull { field ->
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract class CLITool<A : CommonToolArguments> {
|
||||
K2JVMCompiler.resetInitStartTime()
|
||||
|
||||
val arguments = createArguments()
|
||||
parseCommandLineArguments(args, arguments)
|
||||
parseCommandLineArguments(args.asList(), arguments)
|
||||
val collector = PrintingMessageCollector(errStream, messageRenderer, arguments.verbose)
|
||||
|
||||
try {
|
||||
@@ -99,7 +99,7 @@ abstract class CLITool<A : CommonToolArguments> {
|
||||
|
||||
// Used in kotlin-maven-plugin (KotlinCompileMojoBase) and in kotlin-gradle-plugin (KotlinJvmOptionsImpl, KotlinJsOptionsImpl)
|
||||
fun parseArguments(args: Array<out String>, arguments: A) {
|
||||
parseCommandLineArguments(args, arguments)
|
||||
parseCommandLineArguments(args.asList(), arguments)
|
||||
val message = validateArguments(arguments.errors)
|
||||
if (message != null) {
|
||||
throw IllegalArgumentException(message)
|
||||
|
||||
Reference in New Issue
Block a user