Revert "Optimize MutableDiagnosticsWithSuppression"

Fixes flaky tests on windows:
QuickFixTestGenerated$Suppress$AnnotationPosition
  .testTopLevelFunctionSuppressOnFile
  .testTopLevelFunctionSuppressOnFileWithSuppress
This commit is contained in:
Ilya Chernikov
2020-03-20 08:02:25 +01:00
parent 4f042cbea5
commit 831806fe2f
@@ -39,16 +39,11 @@ class MutableDiagnosticsWithSuppression @JvmOverloads constructor(
private fun readonlyView(): DiagnosticsWithSuppression = cache.value!!
override val modificationTracker by lazy(LazyThreadSafetyMode.PUBLICATION) {
CompositeModificationTracker(delegateDiagnostics.modificationTracker)
}
override val modificationTracker = CompositeModificationTracker(delegateDiagnostics.modificationTracker)
override fun all(): Collection<Diagnostic> =
if (diagnosticList.isEmpty()) delegateDiagnostics.all() else readonlyView().all()
override fun forElement(psiElement: PsiElement) =
if (diagnosticList.isEmpty()) delegateDiagnostics.forElement(psiElement) else readonlyView().forElement(psiElement)
override fun noSuppression() =
if (diagnosticList.isEmpty()) delegateDiagnostics.noSuppression() else readonlyView().noSuppression()
override fun all(): Collection<Diagnostic> = readonlyView().all()
override fun forElement(psiElement: PsiElement) = readonlyView().forElement(psiElement)
override fun noSuppression() = readonlyView().noSuppression()
//essential that this list is readonly
fun getOwnDiagnostics(): List<Diagnostic> {