[SLC] rename from SimpleAnnotationsBox to ComputeAllAtOnceAnnotationsBox

^KT-56046
This commit is contained in:
Dmitrii Gridin
2023-02-02 15:03:55 +01:00
committed by Space Team
parent 0b7ef03490
commit 650267592c
3 changed files with 7 additions and 5 deletions
@@ -12,7 +12,7 @@ import com.intellij.psi.PsiModifierList
* This class is used as a proxy for [com.intellij.psi.PsiAnnotationOwner]. * This class is used as a proxy for [com.intellij.psi.PsiAnnotationOwner].
* *
* [LazyAnnotationsBox] provides an ability to compute each annotation separately and in a lazy way to avoid heavy computation. * [LazyAnnotationsBox] provides an ability to compute each annotation separately and in a lazy way to avoid heavy computation.
* [SimpleAnnotationsBox] provides an ability to compute all annotations once on first access. * [ComputeAllAtOnceAnnotationsBox] provides an ability to compute all annotations once on first access.
* [EmptyAnnotationsBox] just a box without annotations. * [EmptyAnnotationsBox] just a box without annotations.
* *
* @see org.jetbrains.kotlin.light.classes.symbol.modifierLists.SymbolLightModifierList * @see org.jetbrains.kotlin.light.classes.symbol.modifierLists.SymbolLightModifierList
@@ -10,7 +10,9 @@ import com.intellij.psi.PsiModifierList
import org.jetbrains.kotlin.light.classes.symbol.toArrayIfNotEmptyOrDefault import org.jetbrains.kotlin.light.classes.symbol.toArrayIfNotEmptyOrDefault
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater import java.util.concurrent.atomic.AtomicReferenceFieldUpdater
internal class SimpleAnnotationsBox(private val annotationsComputer: (PsiModifierList) -> Collection<PsiAnnotation>) : AnnotationsBox { internal class ComputeAllAtOnceAnnotationsBox(
private val annotationsComputer: (PsiModifierList) -> Collection<PsiAnnotation>,
) : AnnotationsBox {
@Volatile @Volatile
private var cachedAnnotations: Collection<PsiAnnotation>? = null private var cachedAnnotations: Collection<PsiAnnotation>? = null
@@ -34,7 +36,7 @@ internal class SimpleAnnotationsBox(private val annotationsComputer: (PsiModifie
companion object { companion object {
private val fieldUpdater = AtomicReferenceFieldUpdater.newUpdater( private val fieldUpdater = AtomicReferenceFieldUpdater.newUpdater(
/* tclass = */ SimpleAnnotationsBox::class.java, /* tclass = */ ComputeAllAtOnceAnnotationsBox::class.java,
/* vclass = */ Collection::class.java, /* vclass = */ Collection::class.java,
/* fieldName = */ "cachedAnnotations", /* fieldName = */ "cachedAnnotations",
) )
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer
import org.jetbrains.kotlin.analysis.api.symbols.sourcePsiSafe import org.jetbrains.kotlin.analysis.api.symbols.sourcePsiSafe
import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin
import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.asJava.classes.lazyPub
import org.jetbrains.kotlin.light.classes.symbol.annotations.SimpleAnnotationsBox import org.jetbrains.kotlin.light.classes.symbol.annotations.ComputeAllAtOnceAnnotationsBox
import org.jetbrains.kotlin.light.classes.symbol.annotations.SymbolLightSimpleAnnotation import org.jetbrains.kotlin.light.classes.symbol.annotations.SymbolLightSimpleAnnotation
import org.jetbrains.kotlin.light.classes.symbol.annotations.hasDeprecatedAnnotation import org.jetbrains.kotlin.light.classes.symbol.annotations.hasDeprecatedAnnotation
import org.jetbrains.kotlin.light.classes.symbol.classes.SymbolLightClassForClassLike import org.jetbrains.kotlin.light.classes.symbol.classes.SymbolLightClassForClassLike
@@ -65,7 +65,7 @@ internal class SymbolLightFieldForObject private constructor(
}, },
computer = ::computeModifiers, computer = ::computeModifiers,
), ),
annotationsBox = SimpleAnnotationsBox { modifierList -> annotationsBox = ComputeAllAtOnceAnnotationsBox { modifierList ->
listOf(SymbolLightSimpleAnnotation(NotNull::class.java.name, modifierList)) listOf(SymbolLightSimpleAnnotation(NotNull::class.java.name, modifierList))
}, },
) )