From d2d5f005be6565ca3a23b8e03674293aface27e9 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Wed, 29 Aug 2012 16:26:14 +0400 Subject: [PATCH] Workaround for failing tests (see comments in the code) --- .../jet/checkers/AbstractJetPsiCheckerTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/idea/tests/org/jetbrains/jet/checkers/AbstractJetPsiCheckerTest.java b/idea/tests/org/jetbrains/jet/checkers/AbstractJetPsiCheckerTest.java index ee921e478a2..d4181686dda 100644 --- a/idea/tests/org/jetbrains/jet/checkers/AbstractJetPsiCheckerTest.java +++ b/idea/tests/org/jetbrains/jet/checkers/AbstractJetPsiCheckerTest.java @@ -16,8 +16,10 @@ package org.jetbrains.jet.checkers; +import com.intellij.ProjectTopics; import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.roots.impl.ModuleRootEventImpl; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.plugin.PluginTestCaseBase; import org.jetbrains.jet.test.generator.SimpleTestClassModel; @@ -32,6 +34,20 @@ import java.util.Arrays; */ public abstract class AbstractJetPsiCheckerTest extends LightDaemonAnalyzerTestCase { + @Override + protected void tearDown() throws Exception { + super.tearDown(); + /* + * TODO: remove this when fixed in IDEA + * super.tearDown() calls cleanupForNextTest() on PsiManagerImpl, which invalidates a cache of view providers + * this affects ExternalAnnotationsManagerImpl making XmlFile instances cached in it invalid + * this results in external annotations being not found, unless we invalidate the cache in ExternalAnnotationsManagerImpl. + * Currently, sending this funny event is the only way (apart from reflection) to invalidate that cache. + * The problem will be fixed in IDEA soon (hopefully). + */ + getProject().getMessageBus().syncPublisher(ProjectTopics.PROJECT_ROOTS).rootsChanged(new ModuleRootEventImpl(getProject(), true)); + } + public void doTest(@NotNull String filePath) throws Exception { doTest(filePath, true, false); }