[SLC] LazyAnnotationsBox: fix case with empty AnnotationsProvider
^KT-56046
This commit is contained in:
committed by
Space Team
parent
e4795a9082
commit
6a65708631
+13
-17
@@ -28,25 +28,21 @@ internal class LazyAnnotationsBox(
|
|||||||
SymbolLightLazyAnnotation(classId, annotationsProvider, index, owner)
|
SymbolLightLazyAnnotation(classId, annotationsProvider, index, owner)
|
||||||
}
|
}
|
||||||
|
|
||||||
val valueToReturn = if (annotations.isEmpty()) {
|
val valueToReturn = synchronized(monitor) {
|
||||||
setAnnotationsArray(PsiAnnotation.EMPTY_ARRAY)
|
specialAnnotations?.forEach { specialAnnotation ->
|
||||||
} else {
|
val index = annotations.indexOfFirst { it.qualifiedName == specialAnnotation.qualifiedName }
|
||||||
synchronized(monitor) {
|
if (index != -1) {
|
||||||
specialAnnotations?.forEach { specialAnnotation ->
|
annotations[index] = specialAnnotation
|
||||||
val index = annotations.indexOfFirst { it.qualifiedName == specialAnnotation.qualifiedName }
|
} else {
|
||||||
if (index != -1) {
|
annotations += specialAnnotation
|
||||||
annotations[index] = specialAnnotation
|
|
||||||
} else {
|
|
||||||
annotations += specialAnnotation
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val foundQualifiers = hashSetOf<String>()
|
|
||||||
additionalAnnotationsProvider.addAllAnnotations(annotations, foundQualifiers, owner)
|
|
||||||
|
|
||||||
specialAnnotations = null
|
|
||||||
setAnnotationsArray(annotations.toTypedArray())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val foundQualifiers = annotations.mapNotNullTo(hashSetOf()) { it.qualifiedName }
|
||||||
|
additionalAnnotationsProvider.addAllAnnotations(annotations, foundQualifiers, owner)
|
||||||
|
|
||||||
|
specialAnnotations = null
|
||||||
|
setAnnotationsArray(if (annotations.isNotEmpty()) annotations.toTypedArray() else PsiAnnotation.EMPTY_ARRAY)
|
||||||
}
|
}
|
||||||
|
|
||||||
return valueToReturn
|
return valueToReturn
|
||||||
|
|||||||
Reference in New Issue
Block a user