[FIR] Add workaround for exception in JavaOverrideChecker.buildErasure

- `useMutableOrEmpty` causes the bounds to be replaced atomically, which
  avoids the race described in KT-60324.

^KT-60324 fixed
^KT-60445
This commit is contained in:
Marco Pennekamp
2023-12-18 18:46:16 +01:00
committed by Space Team
parent 73032213f0
commit 85c4d6b67b
3 changed files with 5 additions and 5 deletions
@@ -52,7 +52,7 @@ class FirTypeParameterBuilder : FirAnnotationContainerBuilder {
containingDeclarationSymbol,
variance,
isReified,
bounds,
bounds.toMutableOrEmpty(),
annotations.toMutableOrEmpty(),
)
}
@@ -37,7 +37,7 @@ internal class FirTypeParameterImpl(
override val containingDeclarationSymbol: FirBasedSymbol<*>,
override val variance: Variance,
override val isReified: Boolean,
override val bounds: MutableList<FirTypeRef>,
override var bounds: MutableOrEmptyList<FirTypeRef>,
override var annotations: MutableOrEmptyList<FirAnnotation>,
) : FirTypeParameter() {
@@ -63,8 +63,7 @@ internal class FirTypeParameterImpl(
}
override fun replaceBounds(newBounds: List<FirTypeRef>) {
bounds.clear()
bounds.addAll(newBounds)
bounds = newBounds.toMutableOrEmpty()
}
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {