JVM: report error on -Xjdk-release=6 without -jvm-target

#KT-59098
This commit is contained in:
Alexander Udalov
2024-02-14 15:44:49 +01:00
committed by Space Team
parent cdcb65c749
commit 1bc08fc5b8
4 changed files with 20 additions and 1 deletions
@@ -52,7 +52,15 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
}
val jvmTargetValue = when (releaseTargetArg) {
"6" -> "1.6"
"6", "1.6" -> {
if (jvmTargetArg == null) {
messageCollector.report(
ERROR,
"'-Xjdk-release=$releaseTargetArg' option requires explicit JVM target. Please specify the '-jvm-target' option"
)
}
jvmTargetArg
}
"8" -> "1.8"
null -> jvmTargetArg
else -> releaseTargetArg
@@ -0,0 +1,4 @@
-Xjdk-release=1.6
$TESTDATA_DIR$/jdkRelease.kt
-d
$TEMP_DIR$
@@ -0,0 +1,2 @@
error: '-Xjdk-release=1.6' option requires explicit JVM target. Please specify the '-jvm-target' option
COMPILATION_ERROR
@@ -755,6 +755,11 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/jdkRelease.args");
}
@TestMetadata("jdkRelease6WithoutExplicitJvmTarget.args")
public void testJdkRelease6WithoutExplicitJvmTarget() {
runTest("compiler/testData/cli/jvm/jdkRelease6WithoutExplicitJvmTarget.args");
}
@TestMetadata("jdkRelease8.args")
public void testJdkRelease8() {
runTest("compiler/testData/cli/jvm/jdkRelease8.args");