Daemon: do not exit with internal error on invalid arguments
Invalid compiler arguments should lead to a compilation error, not internal error. This has been fixed by splitting the "parseArguments(...)" call (which does parsing + validation) in CompileServiceImpl into two calls of parseCommandLineArguments + validateArguments, and returning with a compilation error if the latter did not succeed #KT-16057 Fixed #KT-14848 In Progress
This commit is contained in:
+1
-1
@@ -49,7 +49,7 @@ data class ArgumentParseErrors(
|
||||
var argumentWithoutValue: String? = null
|
||||
)
|
||||
|
||||
// Parses arguments in the passed [result] object, or throws an [IllegalArgumentException] with the message to be displayed to the user
|
||||
// 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) {
|
||||
data class ArgumentField(val field: Field, val argument: Argument)
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ abstract class CLITool<A : CommonToolArguments> {
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract fun createArguments(): A
|
||||
abstract fun createArguments(): A
|
||||
|
||||
// Used in kotlin-maven-plugin (KotlinCompileMojoBase) and in kotlin-gradle-plugin (KotlinJvmOptionsImpl, KotlinJsOptionsImpl)
|
||||
fun parseArguments(args: Array<out String>, arguments: A) {
|
||||
|
||||
@@ -82,7 +82,7 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected K2JSCompilerArguments createArguments() {
|
||||
public K2JSCompilerArguments createArguments() {
|
||||
return new K2JSCompilerArguments();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user