Add JVM target bytecode version 18

#KT-51309 Fixed
This commit is contained in:
Alexander Udalov
2022-02-14 13:41:07 +01:00
parent 649f246cef
commit 7952e8b28f
7 changed files with 15 additions and 15 deletions
@@ -81,7 +81,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
@Argument(
value = "-jvm-target",
valueDescription = "<version>",
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)
@@ -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
+1 -1
View File
@@ -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 <path> Include a custom JDK from the specified location into the classpath instead of the default JAVA_HOME
-jvm-target <version> 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 <version> Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, ..., 18), default is 1.8
-module-name <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
+1 -1
View File
@@ -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
@@ -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
@@ -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"))
}
@@ -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?