Fix for KT-16614: Report inability to inline 1.8 bytecode into 1.6 bytecode as an error, no as an exception
This commit is contained in:
@@ -17,17 +17,36 @@
|
||||
package org.jetbrains.kotlin.config
|
||||
|
||||
import org.jetbrains.kotlin.utils.DescriptionAware
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
|
||||
enum class JvmTarget(override val description: String) : DescriptionAware {
|
||||
JVM_1_6("1.6"),
|
||||
JVM_1_8("1.8"),
|
||||
;
|
||||
|
||||
val bytecodeVersion: Int
|
||||
get() = when(this) {
|
||||
JVM_1_6 -> Opcodes.V1_6
|
||||
JVM_1_8 -> Opcodes.V1_8
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val DEFAULT = JVM_1_6
|
||||
|
||||
@JvmStatic
|
||||
fun fromString(string: String) = values().find { it.description == string }
|
||||
|
||||
fun getDescription(bytecodeVersion: Int): String {
|
||||
val platformDescription = values().find { it.bytecodeVersion == bytecodeVersion }?.description ?:
|
||||
when (bytecodeVersion) {
|
||||
Opcodes.V1_7 -> "1.7"
|
||||
Opcodes.V1_8 + 1 -> "1.9"
|
||||
else -> null
|
||||
}
|
||||
|
||||
return if (platformDescription != null) "JVM target $platformDescription"
|
||||
else "JVM bytecode version $bytecodeVersion"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user