From 831806fe2fdbb420d2d606c179959973f38dc231 Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Fri, 20 Mar 2020 08:02:25 +0100 Subject: [PATCH] Revert "Optimize MutableDiagnosticsWithSuppression" Fixes flaky tests on windows: QuickFixTestGenerated$Suppress$AnnotationPosition .testTopLevelFunctionSuppressOnFile .testTopLevelFunctionSuppressOnFileWithSuppress --- .../MutableDiagnosticsWithSuppression.kt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/MutableDiagnosticsWithSuppression.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/MutableDiagnosticsWithSuppression.kt index 847f53487ec..47b3f4934ce 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/MutableDiagnosticsWithSuppression.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/MutableDiagnosticsWithSuppression.kt @@ -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 = - 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 = readonlyView().all() + override fun forElement(psiElement: PsiElement) = readonlyView().forElement(psiElement) + override fun noSuppression() = readonlyView().noSuppression() //essential that this list is readonly fun getOwnDiagnostics(): List {