Add JVM bytecode target version 13

#KT-34119 Fixed
This commit is contained in:
Alexander Udalov
2019-10-25 11:37:23 +02:00
parent 1354de1780
commit df4ab4ed81
7 changed files with 36 additions and 38 deletions
@@ -174,39 +174,34 @@ private class AdditionalClassAnnotationLowering(private val context: JvmBackendC
)
}
private val annotationTargetMaps: Map<JvmTarget, MutableMap<KotlinTarget, IrEnumEntry>> =
private val jvm6TargetMap = mutableMapOf(
KotlinTarget.CLASS to etType,
KotlinTarget.ANNOTATION_CLASS to etAnnotationType,
KotlinTarget.CONSTRUCTOR to etConstructor,
KotlinTarget.LOCAL_VARIABLE to etLocalVariable,
KotlinTarget.FUNCTION to etMethod,
KotlinTarget.PROPERTY_GETTER to etMethod,
KotlinTarget.PROPERTY_SETTER to etMethod,
KotlinTarget.FIELD to etField,
KotlinTarget.VALUE_PARAMETER to etParameter
)
private val jvm8TargetMap = jvm6TargetMap + mutableMapOf(
KotlinTarget.TYPE_PARAMETER to etTypeParameter,
KotlinTarget.TYPE to etTypeUse
)
private val annotationTargetMaps: Map<JvmTarget, Map<KotlinTarget, IrEnumEntry>> =
mapOf(
JvmTarget.JVM_1_6 to mutableMapOf(
KotlinTarget.CLASS to etType,
KotlinTarget.ANNOTATION_CLASS to etAnnotationType,
KotlinTarget.CONSTRUCTOR to etConstructor,
KotlinTarget.LOCAL_VARIABLE to etLocalVariable,
KotlinTarget.FUNCTION to etMethod,
KotlinTarget.PROPERTY_GETTER to etMethod,
KotlinTarget.PROPERTY_SETTER to etMethod,
KotlinTarget.FIELD to etField,
KotlinTarget.VALUE_PARAMETER to etParameter
),
// additional values for jvm8
JvmTarget.JVM_1_8 to mutableMapOf(
KotlinTarget.TYPE_PARAMETER to etTypeParameter,
KotlinTarget.TYPE to etTypeUse
),
JvmTarget.JVM_9 to mutableMapOf(),
JvmTarget.JVM_10 to mutableMapOf(),
JvmTarget.JVM_11 to mutableMapOf(),
JvmTarget.JVM_12 to mutableMapOf()
JvmTarget.JVM_1_6 to jvm6TargetMap,
JvmTarget.JVM_1_8 to jvm8TargetMap,
JvmTarget.JVM_9 to jvm8TargetMap,
JvmTarget.JVM_10 to jvm8TargetMap,
JvmTarget.JVM_11 to jvm8TargetMap,
JvmTarget.JVM_12 to jvm8TargetMap,
JvmTarget.JVM_13 to jvm8TargetMap
)
init {
annotationTargetMaps[JvmTarget.JVM_1_8]!!.putAll(annotationTargetMaps[JvmTarget.JVM_1_6]!!.toList())
annotationTargetMaps[JvmTarget.JVM_9]!!.putAll(annotationTargetMaps[JvmTarget.JVM_1_8]!!.toList())
annotationTargetMaps[JvmTarget.JVM_10]!!.putAll(annotationTargetMaps[JvmTarget.JVM_9]!!.toList())
annotationTargetMaps[JvmTarget.JVM_11]!!.putAll(annotationTargetMaps[JvmTarget.JVM_10]!!.toList())
annotationTargetMaps[JvmTarget.JVM_12]!!.putAll(annotationTargetMaps[JvmTarget.JVM_11]!!.toList())
}
private fun generateTargetAnnotation(irClass: IrClass) {
if (irClass.hasAnnotation(FqName("java.lang.annotation.Target"))) return
val annotationTargetMap = annotationTargetMaps[jvmTarget]