[FIR] FirBasedSymbol: iterate annotations by index instead of iterator to avoid possible ConcurrentModificationException
^KT-56046
This commit is contained in:
committed by
Space Team
parent
19a61015c0
commit
38575cdbc1
@@ -79,7 +79,17 @@ fun FirAnnotationContainer.resolvedAnnotationsWithArguments(anchorElement: FirBa
|
||||
fun List<FirAnnotation>.resolvedAnnotationsWithArguments(anchorElement: FirBasedSymbol<*>): List<FirAnnotation> {
|
||||
if (isEmpty()) return emptyList()
|
||||
|
||||
val phase = if (any { it is FirAnnotationCall && it.arguments.isNotEmpty() }) {
|
||||
// this loop by index is required to avoid possible ConcurrentModificationException
|
||||
var hasAnnotationCallWithArguments = false
|
||||
for (i in indices) {
|
||||
val currentAnnotation = get(i)
|
||||
if (currentAnnotation is FirAnnotationCall && currentAnnotation.arguments.isNotEmpty()) {
|
||||
hasAnnotationCallWithArguments = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
val phase = if (hasAnnotationCallWithArguments) {
|
||||
FirResolvePhase.ANNOTATIONS_ARGUMENTS_MAPPING
|
||||
} else {
|
||||
FirResolvePhase.TYPES
|
||||
|
||||
Reference in New Issue
Block a user