[SLC] introduce SimpleAdditionalAnnotationsProvider
^KT-56046
This commit is contained in:
committed by
Space Team
parent
ba3ea40a70
commit
31701ba673
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.light.classes.symbol.annotations
|
||||
|
||||
import com.intellij.psi.PsiAnnotation
|
||||
import com.intellij.psi.PsiModifierList
|
||||
|
||||
internal class SimpleAdditionalAnnotationsProvider(
|
||||
private val additionalAnnotationQualifiers: Collection<String>,
|
||||
) : AdditionalAnnotationsProvider {
|
||||
constructor(qualifiedName: String) : this(setOf(qualifiedName))
|
||||
|
||||
override fun addAllAnnotations(
|
||||
currentRawAnnotations: MutableList<in PsiAnnotation>,
|
||||
foundQualifiers: MutableSet<String>,
|
||||
owner: PsiModifierList
|
||||
) {
|
||||
for (qualifiedName in additionalAnnotationQualifiers) {
|
||||
addSimpleAnnotationIfMissing(qualifiedName, currentRawAnnotations, foundQualifiers, owner)
|
||||
}
|
||||
}
|
||||
|
||||
override fun findAdditionalAnnotation(
|
||||
annotationsBox: LazyAnnotationsBox,
|
||||
qualifiedName: String,
|
||||
owner: PsiModifierList
|
||||
): PsiAnnotation? {
|
||||
if (qualifiedName !in additionalAnnotationQualifiers) return null
|
||||
|
||||
return createSimpleAnnotationIfMatches(qualifiedName, qualifiedName, owner)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user