diff --git a/analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/annotations/AnnotationsProvider.kt b/analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/annotations/AnnotationsProvider.kt index 078043d6bf7..32a5399e700 100644 --- a/analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/annotations/AnnotationsProvider.kt +++ b/analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/annotations/AnnotationsProvider.kt @@ -7,11 +7,37 @@ package org.jetbrains.kotlin.light.classes.symbol.annotations import org.jetbrains.kotlin.analysis.api.annotations.KtAnnotationApplicationInfo import org.jetbrains.kotlin.analysis.api.annotations.KtAnnotationApplicationWithArgumentsInfo +import org.jetbrains.kotlin.analysis.api.symbols.markers.KtAnnotatedSymbol import org.jetbrains.kotlin.name.ClassId +/** + * This class provides annotations to [LazyAnnotationsBox]. + * + * [EmptyAnnotationsProvider] is just an empty provider. + * [SymbolAnnotationsProvider] is a provider based on [KtAnnotatedSymbol] API. + * [CompositeAnnotationsProvider] is a composition of some [AnnotationsProvider]. + * + * @see [LazyAnnotationsBox] + */ internal sealed interface AnnotationsProvider { + /** + * @return a list of [KtAnnotationApplicationInfo] applicable for this provider + */ fun annotationInfos(): List operator fun get(classId: ClassId): Collection operator fun contains(classId: ClassId): Boolean + + /** + * Example: + * ``` + * package one + * + * @Ann1 @Ann2 + * class Foo + * ``` + * If this provider provides annotations from `Foo` class then the result of the function will be [ClassId] for `one.Foo` + * + * @return [ClassId] of an owner of annotations from this provider + */ fun ownerClassId(): ClassId? }