diff --git a/java/compiler/impl/src/com/intellij/openapi/compiler/util/InspectionValidatorWrapper.java b/java/compiler/impl/src/com/intellij/openapi/compiler/util/InspectionValidatorWrapper.java index cadbc0fa5267..3d03858bbb5f 100644 --- a/java/compiler/impl/src/com/intellij/openapi/compiler/util/InspectionValidatorWrapper.java +++ b/java/compiler/impl/src/com/intellij/openapi/compiler/util/InspectionValidatorWrapper.java @@ -1,5 +1,17 @@ /* - * Copyright (c) 2000-2007 JetBrains s.r.o. All Rights Reserved. + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.intellij.openapi.compiler.util; @@ -8,7 +20,6 @@ import com.intellij.codeInsight.daemon.HighlightDisplayKey; import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl; import com.intellij.codeInsight.daemon.impl.HighlightInfo; import com.intellij.codeInspection.*; -import com.intellij.codeInspection.ex.InspectionManagerEx; import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; import com.intellij.compiler.options.ValidationConfiguration; import com.intellij.lang.ExternalLanguageAnnotators; @@ -81,7 +92,7 @@ public class InspectionValidatorWrapper implements Validator { private static List runInspectionOnFile(@NotNull PsiFile file, @NotNull LocalInspectionTool inspectionTool) { - InspectionManagerEx inspectionManager = (InspectionManagerEx)InspectionManager.getInstance(file.getProject()); + InspectionManager inspectionManager = InspectionManager.getInstance(file.getProject()); GlobalInspectionContext context = inspectionManager.createNewGlobalContext(false); return InspectionEngine.runInspectionOnFile(file, new LocalInspectionToolWrapper(inspectionTool), context); } diff --git a/java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java b/java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java index 5962675dcbb0..f1c5e77ee08d 100644 --- a/java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java +++ b/java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java @@ -148,7 +148,7 @@ public abstract class InspectionTestCase extends PsiTestCase { final GlobalInspectionContextImpl globalContext = CodeInsightTestFixtureImpl.createGlobalContextForTool(scope, getProject(), inspectionManager, toolWrappers); - InspectionTestUtil.runTool(toolWrapper, scope, globalContext, inspectionManager); + InspectionTestUtil.runTool(toolWrapper, scope, globalContext); return globalContext; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java index 733307d5c6a3..107771296a67 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java @@ -135,7 +135,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass protected void collectInformationWithProgress(@NotNull ProgressIndicator progress) { try { if (!HighlightingLevelManager.getInstance(myProject).shouldInspect(myFile)) return; - final InspectionManagerEx iManager = (InspectionManagerEx)InspectionManager.getInstance(myProject); + final InspectionManager iManager = InspectionManager.getInstance(myProject); final InspectionProfileWrapper profile = myProfileWrapper; inspect(getInspectionTools(profile), iManager, true, true, DumbService.isDumb(myProject), progress); } @@ -149,7 +149,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass } public void doInspectInBatch(@NotNull final GlobalInspectionContextImpl context, - @NotNull final InspectionManagerEx iManager, + @NotNull final InspectionManager iManager, @NotNull final List toolWrappers) { final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator(); inspect(new ArrayList(toolWrappers), iManager, false, false, false, progress); @@ -173,7 +173,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass toolWrapper.getTool()); } - private void addDescriptorsFromInjectedResults(@NotNull InspectionManagerEx iManager, @NotNull GlobalInspectionContextImpl context) { + private void addDescriptorsFromInjectedResults(@NotNull InspectionManager iManager, @NotNull GlobalInspectionContextImpl context) { InjectedLanguageManager ilManager = InjectedLanguageManager.getInstance(myProject); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject); @@ -211,7 +211,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass } private void inspect(@NotNull final List toolWrappers, - @NotNull final InspectionManagerEx iManager, + @NotNull final InspectionManager iManager, final boolean isOnTheFly, boolean failFastOnAcquireReadAction, boolean checkDumbAwareness, @@ -242,7 +242,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass @NotNull private List visitPriorityElementsAndInit(@NotNull MultiMap toolToLanguages, - @NotNull final InspectionManagerEx iManager, + @NotNull final InspectionManager iManager, final boolean isOnTheFly, @NotNull final ProgressIndicator indicator, @NotNull final List elements, @@ -266,7 +266,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass private boolean runToolOnElements(@NotNull final LocalInspectionToolWrapper toolWrapper, Collection languages, - @NotNull final InspectionManagerEx iManager, + @NotNull final InspectionManager iManager, final boolean isOnTheFly, @NotNull final ProgressIndicator indicator, @NotNull final List elements, @@ -329,7 +329,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass void inspectInjectedPsi(@NotNull final List elements, final boolean onTheFly, @NotNull final ProgressIndicator indicator, - @NotNull final InspectionManagerEx iManager, + @NotNull final InspectionManager iManager, final boolean inVisibleRange, final boolean checkDumbAwareness, @NotNull final List wrappers) { @@ -655,7 +655,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass private void doInspectInjectedPsi(@NotNull PsiFile injectedPsi, final boolean isOnTheFly, @NotNull final ProgressIndicator indicator, - @NotNull InspectionManagerEx iManager, + @NotNull InspectionManager iManager, final boolean inVisibleRange, @NotNull List wrappers, boolean checkDumbAwareness) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WholeFileLocalInspectionsPassFactory.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WholeFileLocalInspectionsPassFactory.java index a1d95d51d7b4..ff0b41f7b489 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WholeFileLocalInspectionsPassFactory.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WholeFileLocalInspectionsPassFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import com.intellij.codeHighlighting.TextEditorHighlightingPass; import com.intellij.codeHighlighting.TextEditorHighlightingPassFactory; import com.intellij.codeHighlighting.TextEditorHighlightingPassRegistrar; import com.intellij.codeInsight.daemon.DaemonBundle; -import com.intellij.codeInspection.ex.InspectionManagerEx; +import com.intellij.codeInspection.InspectionManager; import com.intellij.codeInspection.ex.InspectionProfileWrapper; import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; import com.intellij.openapi.Disposable; @@ -122,7 +122,7 @@ public class WholeFileLocalInspectionsPassFactory extends AbstractProjectCompone void inspectInjectedPsi(@NotNull List elements, boolean onTheFly, @NotNull ProgressIndicator indicator, - @NotNull InspectionManagerEx iManager, + @NotNull InspectionManager iManager, boolean inVisibleRange, boolean checkDumbAwareness, @NotNull List wrappers) { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java index a82d5ba1f69d..b189b1dfa2d6 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java @@ -312,7 +312,7 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp @Override protected void runTools(@NotNull AnalysisScope scope, boolean runGlobalToolsOnly) { - final InspectionManagerEx inspectionManager = (InspectionManagerEx)InspectionManager.getInstance(getProject()); + final InspectionManager inspectionManager = InspectionManager.getInstance(getProject()); List globalTools = new ArrayList(); final List localTools = new ArrayList(); final List globalSimpleTools = new ArrayList(); @@ -403,7 +403,7 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp } } - private void runGlobalTools(@NotNull AnalysisScope scope, @NotNull InspectionManagerEx inspectionManager, @NotNull List globalTools) { + private void runGlobalTools(@NotNull AnalysisScope scope, @NotNull InspectionManager inspectionManager, @NotNull List globalTools) { final List needRepeatSearchRequest = new ArrayList(); final boolean surelyNoExternalUsages = scope.getScopeType() == AnalysisScope.PROJECT; @@ -678,8 +678,9 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp range != null ? range.getEndOffset() : file.getTextLength(), LocalInspectionsPass.EMPTY_PRIORITY_RANGE, true, HighlightInfoProcessor.getEmpty()); Runnable runnable = new Runnable() { + @Override public void run() { - pass.doInspectInBatch(GlobalInspectionContextImpl.this, (InspectionManagerEx)InspectionManager.getInstance(project), lTools); + pass.doInspectInBatch(GlobalInspectionContextImpl.this, InspectionManager.getInstance(project), lTools); } }; ApplicationManager.getApplication().runReadAction(runnable); diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionManagerEx.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionManagerEx.java index c73f9c29fde1..f4c151623ca4 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionManagerEx.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionManagerEx.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.regex.Pattern; public class InspectionManagerEx extends InspectionManagerBase { - private GlobalInspectionContextImpl myGlobalInspectionContext = null; + private GlobalInspectionContextImpl myGlobalInspectionContext; private final NotNullLazyValue myContentManager; private final Set myRunningContexts = new HashSet(); @@ -149,6 +149,7 @@ public class InspectionManagerEx extends InspectionManagerBase { myRunningContexts.remove(globalInspectionContext); } + @NotNull public Set getRunningContexts() { return myRunningContexts; } diff --git a/platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java index 12989d102dd9..f2a0261fa8fd 100644 --- a/platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java @@ -18,15 +18,14 @@ package com.intellij.testFramework; import com.intellij.analysis.AnalysisScope; import com.intellij.codeInsight.daemon.HighlightDisplayKey; import com.intellij.codeInspection.ex.GlobalInspectionContextImpl; -import com.intellij.codeInspection.ex.InspectionManagerEx; import com.intellij.codeInspection.ex.InspectionToolWrapper; import com.intellij.codeInspection.ui.InspectionToolPresentation; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.JDOMUtil; -import org.junit.Assert; import org.jdom.Document; import org.jdom.Element; import org.jetbrains.annotations.NotNull; +import org.junit.Assert; import java.io.CharArrayReader; import java.io.File; @@ -152,8 +151,7 @@ expected: public static void runTool(@NotNull InspectionToolWrapper toolWrapper, @NotNull final AnalysisScope scope, - @NotNull final GlobalInspectionContextImpl globalContext, - @NotNull final InspectionManagerEx inspectionManager) { + @NotNull final GlobalInspectionContextImpl globalContext) { final String shortName = toolWrapper.getShortName(); final HighlightDisplayKey key = HighlightDisplayKey.find(shortName); if (key == null){ diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index 804c20272076..0c2da8b647a4 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -460,7 +460,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig InspectionManagerEx inspectionManager = (InspectionManagerEx)InspectionManager.getInstance(getProject()); GlobalInspectionContextImpl globalContext = createGlobalContextForTool(scope, getProject(), inspectionManager, toolWrapper); - InspectionTestUtil.runTool(toolWrapper, scope, globalContext, inspectionManager); + InspectionTestUtil.runTool(toolWrapper, scope, globalContext); InspectionTestUtil.compareToolResults(globalContext, toolWrapper, false, new File(getTestDataPath(), testDir).getPath()); }