Files
kotlin-fork/compiler/testData/codegen/box/annotations/annotationTargets.kt
T
Alexander Udalov e399b4cd12 JVM IR: minor, sort ElementType fields as in the old backend
In the old backend, targets are generated in the order of their
declaration in the ElementType enum, see AnnotationCodegen.java:306
(EnumSet guarantees such iteration ordering).

This has no effect other than reducing non-essential differences when
comparing ABI of JVM vs JVM_IR.
2020-10-12 21:38:09 +02:00

20 lines
611 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FULL_JDK
@Target(
AnnotationTarget.FUNCTION, AnnotationTarget.FIELD,
AnnotationTarget.PROPERTY, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER
)
public annotation class TestAnn
fun box(): String {
val testAnnClass = TestAnn::class.java
val targetAnn = testAnnClass.getAnnotation(java.lang.annotation.Target::class.java)
val targets = targetAnn.value.toList()
if (targets != listOf(java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD)) {
return targets.toString()
}
return "OK"
}