diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt index 3c116e54afc..2a6c0d9da2e 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt @@ -866,7 +866,11 @@ Also sets `-jvm-target` value equal to the selected JDK version""" result[JvmAnalysisFlags.jvmDefaultMode] = it } ?: collector.report( CompilerMessageSeverity.ERROR, - "Unknown -Xjvm-default mode: $jvmDefault, supported modes: ${JvmDefaultMode.values().map { it.description }}" + "Unknown -Xjvm-default mode: $jvmDefault, supported modes: ${ + JvmDefaultMode.values().mapNotNull { mode -> + mode.description.takeIf { JvmDefaultMode.fromStringOrNull(it) != null } + } + }" ) result[JvmAnalysisFlags.inheritMultifileParts] = inheritMultifileParts result[JvmAnalysisFlags.sanitizeParentheses] = sanitizeParentheses diff --git a/compiler/testData/cli/jvm/jvmDefaultIncorrectValue.args b/compiler/testData/cli/jvm/jvmDefaultIncorrectValue.args new file mode 100644 index 00000000000..96d4075ec88 --- /dev/null +++ b/compiler/testData/cli/jvm/jvmDefaultIncorrectValue.args @@ -0,0 +1,4 @@ +$TESTDATA_DIR$/simple.kt +-d +$TEMP_DIR$ +-Xjvm-default=enable diff --git a/compiler/testData/cli/jvm/jvmDefaultIncorrectValue.out b/compiler/testData/cli/jvm/jvmDefaultIncorrectValue.out new file mode 100644 index 00000000000..040c19fc235 --- /dev/null +++ b/compiler/testData/cli/jvm/jvmDefaultIncorrectValue.out @@ -0,0 +1,2 @@ +error: unknown -Xjvm-default mode: enable, supported modes: [disable, all-compatibility, all] +COMPILATION_ERROR diff --git a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java index 69dbeda365a..1f3d0713d07 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -840,6 +840,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/jvmDefaultAll.args"); } + @TestMetadata("jvmDefaultIncorrectValue.args") + public void testJvmDefaultIncorrectValue() throws Exception { + runTest("compiler/testData/cli/jvm/jvmDefaultIncorrectValue.args"); + } + @TestMetadata("jvmIrByDefault1_4.args") public void testJvmIrByDefault1_4() throws Exception { runTest("compiler/testData/cli/jvm/jvmIrByDefault1_4.args");