Add JVM target bytecode version 21

Unfortunately, there are still problems with running JVM backend tests
with JVM target 21 because:

1) The D8 version that we use does not support bytecode version 21, and
   updating to a newer version requires to change JVM target of compiler
   tests to 11. This will be addressed separately when we enable JVM 21
   in tests-different-jdk.
2) Some tests are failing because of KT-60659 and KT-60770:
   - builtinStubMethods/bridgesForStubs/emptyStringListAdd.kt
   - jdk/stream.kt
   - regressions/kt528.kt

 #KT-60662 Fixed
This commit is contained in:
Alexander Udalov
2023-07-25 19:08:45 +02:00
committed by Space Team
parent 5cbf5ad529
commit d4b5599373
9 changed files with 16 additions and 13 deletions
@@ -37,6 +37,7 @@ enum class JvmTarget(
JVM_18("18", Opcodes.V16 + 2),
JVM_19("19", Opcodes.V16 + 3),
JVM_20("20", Opcodes.V16 + 4),
JVM_21("21", Opcodes.V16 + 5),
;
override fun toString() = description
@@ -46,10 +47,10 @@ enum class JvmTarget(
val DEFAULT = JVM_1_8
@JvmStatic
fun fromString(string: String) = values().find { it.description == string }
fun fromString(string: String) = entries.find { it.description == string }
fun getDescription(majorVersion: Int): String {
val platformDescription = values().find { it.majorVersion == majorVersion }?.description ?: when (majorVersion) {
val platformDescription = entries.find { it.majorVersion == majorVersion }?.description ?: when (majorVersion) {
Opcodes.V1_7 -> "1.7"
else -> null
}
@@ -59,13 +60,13 @@ enum class JvmTarget(
}
fun supportedValues(): List<JvmTarget> =
values().asList() - JVM_1_6
entries - JVM_1_6
const val SUPPORTED_VERSIONS_DESCRIPTION =
"1.8, 9, 10, ..., 20"
"1.8, 9, 10, ..., 21"
init {
check(SUPPORTED_VERSIONS_DESCRIPTION == "1.8, 9, 10, ..., ${values().last().description}") {
check(SUPPORTED_VERSIONS_DESCRIPTION == "1.8, 9, 10, ..., ${entries.last().description}") {
"Please update the value of the constant JvmTarget.SUPPORTED_VERSIONS_DESCRIPTION."
}
}