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 0927fb9f5ac..7f484c63964 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 @@ -81,7 +81,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { @Argument( value = "-jvm-target", valueDescription = "", - description = "Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, 11, 12, 13, 14, 15, 16 or 17), default is 1.8" + description = "Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, ..., 18), default is 1.8" ) var jvmTarget: String? by NullableStringFreezableVar(null) diff --git a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt index 7669971cf57..2a219195a56 100644 --- a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt +++ b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt @@ -29,11 +29,12 @@ enum class JvmTarget( JVM_10("10", Opcodes.V10), JVM_11("11", Opcodes.V11), JVM_12("12", Opcodes.V12), - JVM_13("13", Opcodes.V12 + 1), - JVM_14("14", Opcodes.V12 + 2), - JVM_15("15", Opcodes.V12 + 3), - JVM_16("16", Opcodes.V12 + 4), - JVM_17("17", Opcodes.V12 + 5), + JVM_13("13", Opcodes.V13), + JVM_14("14", Opcodes.V14), + JVM_15("15", Opcodes.V15), + JVM_16("16", Opcodes.V16), + JVM_17("17", Opcodes.V16 + 1), + JVM_18("18", Opcodes.V16 + 2), ; override fun toString() = description diff --git a/compiler/testData/cli/jvm/help.out b/compiler/testData/cli/jvm/help.out index b7eff6d628f..5101c1efac5 100644 --- a/compiler/testData/cli/jvm/help.out +++ b/compiler/testData/cli/jvm/help.out @@ -6,7 +6,7 @@ where possible options include: -include-runtime Include Kotlin runtime into the resulting JAR -java-parameters Generate metadata for Java 1.8 reflection on method parameters -jdk-home Include a custom JDK from the specified location into the classpath instead of the default JAVA_HOME - -jvm-target Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, 11, 12, 13, 14, 15, 16 or 17), default is 1.8 + -jvm-target Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, ..., 18), default is 1.8 -module-name Name of the generated .kotlin_module file -no-jdk Don't automatically include the Java runtime into the classpath -no-reflect Don't automatically include Kotlin reflection into the classpath diff --git a/compiler/testData/cli/jvm/wrongJvmTargetVersion.out b/compiler/testData/cli/jvm/wrongJvmTargetVersion.out index d870339d0d5..f3322bb585e 100644 --- a/compiler/testData/cli/jvm/wrongJvmTargetVersion.out +++ b/compiler/testData/cli/jvm/wrongJvmTargetVersion.out @@ -1,3 +1,3 @@ error: unknown JVM target version: 1.5 -Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17 +Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 COMPILATION_ERROR diff --git a/compiler/testData/javaModules/releaseFlagWrongValue/module5.txt b/compiler/testData/javaModules/releaseFlagWrongValue/module5.txt deleted file mode 100644 index fdb48415804..00000000000 --- a/compiler/testData/javaModules/releaseFlagWrongValue/module5.txt +++ /dev/null @@ -1,4 +0,0 @@ -error: unknown JDK release version: 5 -error: unknown JVM target version: 5 -Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17 -COMPILATION_ERROR diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/JavaModulesIntegrationTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/JavaModulesIntegrationTest.kt index 52a982a908e..0156f26e4a3 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/JavaModulesIntegrationTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/JavaModulesIntegrationTest.kt @@ -154,7 +154,10 @@ abstract class JavaModulesIntegrationTest(private val jdkVersion: Int, private v } fun testReleaseFlagWrongValue() { - module("module5", additionalKotlinArguments = listOf("-Xjdk-release=5")) + module("module5", additionalKotlinArguments = listOf("-Xjdk-release=5"), checkKotlinOutput = { output -> + assertTrue(output, "error: unknown JDK release version: 5" in output) + assertTrue(output, "error: unknown JVM target version: 5" in output) + }) if (jdkVersion == 11) { module("module12", additionalKotlinArguments = listOf("-Xjdk-release=12")) } diff --git a/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinJvmOptions.kt b/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinJvmOptions.kt index 96ce29abe95..95513c01500 100644 --- a/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinJvmOptions.kt +++ b/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinJvmOptions.kt @@ -19,8 +19,8 @@ interface KotlinJvmOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOption var jdkHome: kotlin.String? /** - * Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, 11, 12, 13, 14, 15, 16 or 17), default is 1.8 - * Possible values: "1.6", "1.8", "9", "10", "11", "12", "13", "14", "15", "16", "17" + * Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, ..., 18), default is 1.8 + * Possible values: "1.6", "1.8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18" * Default value: null */ var jvmTarget: kotlin.String?