diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/preprocessCommandLineArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/preprocessCommandLineArguments.kt index 77bdd1333c8..b763caa1bfe 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/preprocessCommandLineArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/preprocessCommandLineArguments.kt @@ -62,7 +62,10 @@ private fun Reader.parseNextArgument(): String? { if (r.isWhitespace()) break when (r) { - DOUBLE_QUOTE, SINGLE_QUOTE -> consumeRestOfEscapedSequence(sb, r) + DOUBLE_QUOTE, SINGLE_QUOTE -> { + consumeRestOfEscapedSequence(sb, r) + return sb.toString() + } BACKSLASH -> nextChar()?.apply(sb::append) else -> sb.append(r) } diff --git a/compiler/testData/cli/jvm/argfileWithEmptyArgument.argfile b/compiler/testData/cli/jvm/argfileWithEmptyArgument.argfile new file mode 100644 index 00000000000..515d9a51c63 --- /dev/null +++ b/compiler/testData/cli/jvm/argfileWithEmptyArgument.argfile @@ -0,0 +1,3 @@ +"" +-include-runtime +-progressive diff --git a/compiler/testData/cli/jvm/argfileWithEmptyArgument.args b/compiler/testData/cli/jvm/argfileWithEmptyArgument.args new file mode 100644 index 00000000000..806ee3fd365 --- /dev/null +++ b/compiler/testData/cli/jvm/argfileWithEmptyArgument.args @@ -0,0 +1 @@ +@$TESTDATA_DIR$/argfileWithEmptyArgument.argfile diff --git a/compiler/testData/cli/jvm/argfileWithEmptyArgument.out b/compiler/testData/cli/jvm/argfileWithEmptyArgument.out new file mode 100644 index 00000000000..8ff8dfc0cbd --- /dev/null +++ b/compiler/testData/cli/jvm/argfileWithEmptyArgument.out @@ -0,0 +1,2 @@ +error: source file or directory not found: +COMPILATION_ERROR diff --git a/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java index 52e9ddb1f1d..0860ad33261 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -66,6 +66,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/apiVersionLessThanLanguageUsingArgfile.args"); } + @TestMetadata("argfileWithEmptyArgument.args") + public void testArgfileWithEmptyArgument() throws Exception { + runTest("compiler/testData/cli/jvm/argfileWithEmptyArgument.args"); + } + @TestMetadata("argfileWithEscaping.args") public void testArgfileWithEscaping() throws Exception { runTest("compiler/testData/cli/jvm/argfileWithEscaping.args");