[AA] Add implementation for annotationApplicableTargets.
Adds implementation and tests for the new KtClassOrObjectSymbol.annotationApplicableTargets property on KtSymbolInfoProvider. This implementation delegates to the canonical implementation in AnnotationChecker for FE1.0, and to the implementation in FirAnnotationHelpers for FIR. This change also includes direct tests for annotationApplicableTargets, and a fix for FirClassLikeSymbol.getAllowedAnnotationTargets in FirAnnotationHelpers.
This commit is contained in:
committed by
Ilya Kirillov
parent
3e80433356
commit
eccbc66581
+3
@@ -0,0 +1,3 @@
|
||||
annotation class A()
|
||||
|
||||
@<caret>A object Foo
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
KtAnnotationEntry: @A
|
||||
|
||||
Resolved annotation symbol:
|
||||
annotation class A
|
||||
|
||||
Applicable targets: [ANNOTATION_CLASS, BACKING_FIELD, CLASS, CONSTRUCTOR, FIELD, FUNCTION, LOCAL_VARIABLE, PROPERTY, PROPERTY_GETTER, PROPERTY_SETTER, VALUE_PARAMETER]
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
KtAnnotationEntry: @A
|
||||
|
||||
Resolved annotation symbol:
|
||||
@kotlin.annotation.Target(allowedTargets = [])
|
||||
annotation class A
|
||||
|
||||
Applicable targets: []
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
@Target()
|
||||
annotation class A
|
||||
|
||||
@<caret>A object Foo
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
KtAnnotationEntry: @A
|
||||
|
||||
Resolved annotation symbol:
|
||||
@kotlin.annotation.Target
|
||||
annotation class A
|
||||
|
||||
Applicable targets: []
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
KtAnnotationEntry: @A
|
||||
|
||||
Resolved annotation symbol:
|
||||
@kotlin.annotation.Target(allowedTargets = [kotlin.annotation.AnnotationTarget.CLASS, kotlin.annotation.AnnotationTarget.FILE, kotlin.annotation.AnnotationTarget.FUNCTION, kotlin.annotation.AnnotationTarget.PROPERTY_GETTER, kotlin.annotation.AnnotationTarget.PROPERTY_SETTER])
|
||||
annotation class A
|
||||
|
||||
Applicable targets: [CLASS, FILE, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER]
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// FILE: A.java
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
public @interface A {}
|
||||
|
||||
// FILE: Foo.kt
|
||||
@<caret>A object Foo
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
KtAnnotationEntry: @A
|
||||
|
||||
Resolved annotation symbol:
|
||||
@kotlin.annotation.Target(allowedTargets = [kotlin.annotation.AnnotationTarget.CLASS, kotlin.annotation.AnnotationTarget.FUNCTION, kotlin.annotation.AnnotationTarget.PROPERTY_GETTER, kotlin.annotation.AnnotationTarget.PROPERTY_SETTER, kotlin.annotation.AnnotationTarget.FILE])
|
||||
annotation class A
|
||||
|
||||
Applicable targets: [CLASS, FILE, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER]
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import kotlin.annotation.AnnotationTarget
|
||||
import kotlin.annotation.Target
|
||||
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.PROPERTY)
|
||||
annotation class A
|
||||
|
||||
@<caret>A object Foo
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
KtAnnotationEntry: @A
|
||||
|
||||
Resolved annotation symbol:
|
||||
@kotlin.annotation.Target(allowedTargets = [kotlin.annotation.AnnotationTarget.CLASS, kotlin.annotation.AnnotationTarget.PROPERTY])
|
||||
annotation class A
|
||||
|
||||
Applicable targets: [CLASS, PROPERTY]
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class A()
|
||||
|
||||
@<caret>A object Foo
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
KtAnnotationEntry: @A
|
||||
|
||||
Resolved annotation symbol:
|
||||
class A
|
||||
|
||||
Applicable targets: <null>
|
||||
+1
-1
@@ -180,7 +180,7 @@ KtNamedClassOrObjectSymbol:
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
annotationApplicableTargets: null
|
||||
annotationApplicableTargets: [CLASS, ANNOTATION_CLASS, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, BACKING_FIELD]
|
||||
deprecationStatus: null
|
||||
|
||||
KtFunctionSymbol:
|
||||
|
||||
@@ -180,7 +180,7 @@ KtNamedClassOrObjectSymbol:
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
annotationApplicableTargets: null
|
||||
annotationApplicableTargets: [CLASS, ANNOTATION_CLASS, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, BACKING_FIELD]
|
||||
deprecationStatus: null
|
||||
|
||||
KtFunctionSymbol:
|
||||
|
||||
+4
-4
@@ -22,7 +22,7 @@ KtNamedClassOrObjectSymbol:
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
annotationApplicableTargets: null
|
||||
annotationApplicableTargets: [TYPE]
|
||||
deprecationStatus: null
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
@@ -49,7 +49,7 @@ KtNamedClassOrObjectSymbol:
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
annotationApplicableTargets: null
|
||||
annotationApplicableTargets: [TYPE]
|
||||
deprecationStatus: null
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
@@ -76,7 +76,7 @@ KtNamedClassOrObjectSymbol:
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
annotationApplicableTargets: null
|
||||
annotationApplicableTargets: [TYPE]
|
||||
deprecationStatus: null
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
@@ -103,7 +103,7 @@ KtNamedClassOrObjectSymbol:
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
annotationApplicableTargets: null
|
||||
annotationApplicableTargets: [TYPE]
|
||||
deprecationStatus: null
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
|
||||
@@ -22,7 +22,7 @@ KtNamedClassOrObjectSymbol:
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
annotationApplicableTargets: null
|
||||
annotationApplicableTargets: [TYPE]
|
||||
deprecationStatus: null
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
@@ -49,7 +49,7 @@ KtNamedClassOrObjectSymbol:
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
annotationApplicableTargets: null
|
||||
annotationApplicableTargets: [TYPE]
|
||||
deprecationStatus: null
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
@@ -76,7 +76,7 @@ KtNamedClassOrObjectSymbol:
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
annotationApplicableTargets: null
|
||||
annotationApplicableTargets: [TYPE]
|
||||
deprecationStatus: null
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
@@ -103,7 +103,7 @@ KtNamedClassOrObjectSymbol:
|
||||
typeParameters: []
|
||||
visibility: Public
|
||||
getContainingModule: KtSourceModule "Sources of main"
|
||||
annotationApplicableTargets: null
|
||||
annotationApplicableTargets: [TYPE]
|
||||
deprecationStatus: null
|
||||
|
||||
KtNamedClassOrObjectSymbol:
|
||||
|
||||
Reference in New Issue
Block a user