diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/ImportHelperTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/ImportHelperTest.java index ae1fa551150a..3e3321f99511 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/ImportHelperTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/ImportHelperTest.java @@ -7,7 +7,6 @@ import com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFix; import com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase; import com.intellij.codeInspection.LocalInspectionTool; import com.intellij.codeInspection.unusedImport.UnusedImportLocalInspection; -import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.command.WriteCommandAction; @@ -54,7 +53,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase { public void testImportsInsertedAlphabetically() throws Throwable { @NonNls String text = "class I {}"; final PsiJavaFile file = (PsiJavaFile)configureByText(StdFileTypes.JAVA, text); - assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR)); + assertEmpty(highlightErrors()); CommandProcessor.getInstance().executeCommand( getProject(), new Runnable() { @Override @@ -109,7 +108,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase { "class I {{ max(0, 0); Map.class.hashCode(); min(0,0); Component.class.hashCode(); int i = CENTER; }}"; final PsiJavaFile file = (PsiJavaFile)configureByText(StdFileTypes.JAVA, text); - assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR)); + assertEmpty(highlightErrors()); CommandProcessor.getInstance().executeCommand( getProject(), new Runnable() { @Override @@ -178,7 +177,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase { @WrapInCommand public void testReimportConflictingClasses() throws Exception { configureByFile(BASE_PATH+"/x/Usage.java", BASE_PATH); - assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR)); + assertEmpty(highlightErrors()); CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject()).clone(); settings.CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND = 2; @@ -204,7 +203,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase { @WrapInCommand public void testConflictingClassesFromCurrentPackage() throws Throwable { final PsiFile file = configureByText(StdFileTypes.JAVA, "package java.util; class X{ Date d;}"); - assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR)); + assertEmpty(highlightErrors()); new WriteCommandAction.Simple(getProject()) { @Override @@ -229,7 +228,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase { type(" "); backspace(); - assertOneElement(filter(doHighlighting(), HighlightSeverity.ERROR)); + assertOneElement(highlightErrors()); int offset = myEditor.getCaretModel().getOffset(); PsiReference ref = myFile.findReferenceAt(offset - 1); @@ -244,7 +243,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase { assertEquals(ImportClassFixBase.Result.CLASS_AUTO_IMPORTED, result); UIUtil.dispatchAllInvocationEvents(); - assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR)); + assertEmpty(highlightErrors()); } finally { CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old; @@ -261,7 +260,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase { type(" "); backspace(); - assertEquals(2, filter(doHighlighting(), HighlightSeverity.ERROR).size()); + assertEquals(2, highlightErrors().size()); UIUtil.dispatchAllInvocationEvents(); int offset = myEditor.getCaretModel().getOffset(); @@ -272,7 +271,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase { assertEquals(ImportClassFixBase.Result.CLASS_AUTO_IMPORTED, result); UIUtil.dispatchAllInvocationEvents(); - assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR)); + assertEmpty(highlightErrors()); } finally { CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old; @@ -363,7 +362,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase { DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true); try { - List errs = filter(doHighlighting(), HighlightSeverity.ERROR); + List errs = highlightErrors(); assertEquals(1, errs.size()); @@ -389,7 +388,7 @@ public class ImportHelperTest extends DaemonAnalyzerTestCase { DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true); try { - List errs = filter(doHighlighting(), HighlightSeverity.ERROR); + List errs = highlightErrors(); assertEquals(1, errs.size()); assertEmpty(((PsiJavaFile)getFile()).getImportList().getAllImportStatements()); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java index 2bac9bb26aba..aa839c1bae79 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java @@ -138,13 +138,13 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase { enableInspectionTool(deadCodeInspection); doTest(true, false); - List infos = DaemonAnalyzerTestCase.filter(doHighlighting(), HighlightSeverity.WARNING); + List infos = doHighlighting(HighlightSeverity.WARNING); assertEquals(2, infos.size()); // unused class and unused method try { point.registerExtension(extension); - infos = DaemonAnalyzerTestCase.filter(doHighlighting(), HighlightSeverity.WARNING); + infos = doHighlighting(HighlightSeverity.WARNING); HighlightInfo info = assertOneElement(infos); assertEquals("Class 'WithMain' is never used", info.description); } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingPerformanceTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingPerformanceTest.java index 45277b05641e..a331e33c9cc6 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingPerformanceTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingPerformanceTest.java @@ -19,7 +19,6 @@ import com.intellij.codeInsight.daemon.impl.HighlightInfo; import com.intellij.codeInsight.intention.IntentionManager; import com.intellij.concurrency.JobSchedulerImpl; import com.intellij.lang.LanguageAnnotators; -import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.lang.injection.MultiHostInjector; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ex.PathManagerEx; @@ -107,7 +106,7 @@ public class LightAdvHighlightingPerformanceTest extends LightDaemonAnalyzerTest } }).cpuBound().usesAllCPUCores().assertTiming(); - return DaemonAnalyzerTestCase.filter(infos, HighlightSeverity.ERROR); + return highlightErrors(); } public void testAThinlet() throws Exception { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java index 509b1cd13a31..9deb8c636bc5 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java @@ -54,8 +54,6 @@ import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.util.List; -import static com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase.filter; - /** * This class is for "lightweight" tests only, i.e. those which can run inside default light project set up * For "heavyweight" tests use AdvHighlightingTest @@ -275,7 +273,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase { } }); - List infos = filter(doHighlighting(), HighlightSeverity.WARNING); + List infos = doHighlighting(HighlightSeverity.WARNING); assertEmpty(infos); } @@ -327,7 +325,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase { public void testSOEForTypeOfHugeBinaryExpression() throws IOException { configureFromFileText("a.java", "class A { String s = \"\"; }"); - assertEmpty(filter(doHighlighting(), HighlightSeverity.ERROR)); + assertEmpty(highlightErrors()); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); final StringBuilder sb = new StringBuilder("\"-\""); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/UnusedSymbolLocalTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/UnusedSymbolLocalTest.java index 69536714cab2..ca2c03bdfdb1 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/UnusedSymbolLocalTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/UnusedSymbolLocalTest.java @@ -3,13 +3,11 @@ package com.intellij.codeInsight.daemon; import com.intellij.codeInsight.daemon.impl.HighlightInfo; import com.intellij.codeInspection.LocalInspectionTool; import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection; -import com.intellij.idea.Bombed; +import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Document; import com.intellij.psi.PsiDocumentManager; -import com.intellij.lang.annotation.HighlightSeverity; -import java.util.Calendar; import java.util.Collection; public class UnusedSymbolLocalTest extends DaemonAnalyzerTestCase { @@ -29,7 +27,7 @@ public class UnusedSymbolLocalTest extends DaemonAnalyzerTestCase { public void testChangeInsideCodeBlock() throws Exception { doTest(); final Document document = myEditor.getDocument(); - Collection collection = filter(doHighlighting(), HighlightSeverity.WARNING); + Collection collection = doHighlighting(HighlightSeverity.WARNING); assertEquals(0, collection.size()); final int offset = myEditor.getCaretModel().getOffset(); @@ -42,7 +40,7 @@ public class UnusedSymbolLocalTest extends DaemonAnalyzerTestCase { PsiDocumentManager.getInstance(getProject()).commitDocument(document); - Collection infos = filter(doHighlighting(), HighlightSeverity.WARNING); + Collection infos = doHighlighting(HighlightSeverity.WARNING); assertEquals(1, infos.size()); } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/slice/SliceTreeTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/slice/SliceTreeTest.java index 03553b1dfc5e..624ec7fd314d 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/slice/SliceTreeTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/slice/SliceTreeTest.java @@ -27,7 +27,7 @@ public class SliceTreeTest extends LightDaemonAnalyzerTestCase { PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); PsiElement element = new SliceHandler(true).getExpressionAtCaret(getEditor(), getFile()); assertNotNull(element); - Collection errors = DaemonAnalyzerTestCase.filter(doHighlighting(), HighlightSeverity.ERROR); + Collection errors = highlightErrors(); assertEmpty(errors); SliceAnalysisParams params = new SliceAnalysisParams(); diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java index da4aa999a634..09373f9122b1 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java @@ -57,8 +57,6 @@ import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileFilter; -import com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl; -import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager; import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.*; @@ -197,7 +195,7 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase { ((StartupManagerImpl)StartupManager.getInstance(getProject())).checkCleared(); ((DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(getProject())).cleanupAfterTest(!LightPlatformTestCase.isLight(getProject())); super.tearDown(); - ((VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance()).assertPointersDisposed(); + //((VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance()).assertPointersDisposed(); } protected void enableInspectionTool(InspectionProfileEntry tool){ @@ -333,8 +331,13 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase { } @NotNull - protected Collection highlightErrors() { - return filter(doHighlighting(), HighlightSeverity.ERROR); + protected List highlightErrors() { + return doHighlighting(HighlightSeverity.ERROR); + } + + @NotNull + protected List doHighlighting(@NotNull HighlightSeverity minSeverity) { + return filter(doHighlighting(), minSeverity); } @NotNull diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java index 8438576d3790..97c12f670b20 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java @@ -121,6 +121,11 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa }; } + @NotNull + protected List highlightErrors() { + return doHighlighting(HighlightSeverity.ERROR); + } + @NotNull protected List doHighlighting() { PsiDocumentManager.getInstance(getProject()).commitAllDocuments();