FIR: remap Java meta-annotations to Kotlin equivalents
This is a direct port of JavaAnnotationMapper from the old frontend.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// WITH_REFLECT
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: Ann1.java
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Ann1 {}
|
||||
|
||||
// FILE: Ann2.java
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Ann2 {}
|
||||
|
||||
// FILE: box.kt
|
||||
class C {
|
||||
@Ann1 @Ann2 val x = 1
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
require(C::class.java.getDeclaredField("x")?.getAnnotation(Ann1::class.java) != null) { "no Ann1 on field x" }
|
||||
require(C::class.java.getDeclaredMethod("getX\$annotations")?.getAnnotation(Ann2::class.java) != null) { "no Ann2 on property x" }
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user