[AA] Add meta-annotation test for analysis API.
This test ensures that annotations on other annotations are properly handled, even if those annotations are defined in Java rather than in Kotlin. Note that this functionality only works on FIR, and currently has bugs that mean the result is an error type. Follow-on changes will fix the error-type bug, and restore proper functionality for FIR.
This commit is contained in:
committed by
Yan Zhulanow
parent
686551d1eb
commit
fbcde11b04
+3
@@ -0,0 +1,3 @@
|
||||
KtDeclaration: KtProperty foo
|
||||
annotations: [
|
||||
]
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// FILE: JavaAnno.java
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
|
||||
@Target({FIELD, METHOD})
|
||||
public @interface JavaAnno() {
|
||||
ElementType[] value();
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
import java.lang.annotation.ElementType.FIELD
|
||||
import java.lang.annotation.ElementType.METHOD
|
||||
|
||||
class Test {
|
||||
@JavaAnno(FIELD, METHOD)
|
||||
val f<caret>oo = ""
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
KtDeclaration: KtProperty foo
|
||||
annotations: [
|
||||
JavaAnno(value = [java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD])
|
||||
psi: KtAnnotationEntry
|
||||
annotations: [
|
||||
kotlin/annotation/Target(allowedTargets = error("non-annotation value"))
|
||||
psi: null
|
||||
annotations: [
|
||||
kotlin/annotation/Target(allowedTargets = [kotlin.annotation.AnnotationTarget.ANNOTATION_CLASS])
|
||||
psi: null
|
||||
<recursive meta-annotation kotlin/annotation/Target>
|
||||
kotlin/annotation/MustBeDocumented()
|
||||
psi: null
|
||||
annotations: [
|
||||
kotlin/annotation/Target(allowedTargets = [kotlin.annotation.AnnotationTarget.ANNOTATION_CLASS])
|
||||
psi: null
|
||||
<recursive meta-annotation kotlin/annotation/Target>
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
Reference in New Issue
Block a user