Search in sources :

Example 1 with FieldCanBeLocalInspection

use of com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection in project intellij-community by JetBrains.

the class FieldCanBeLocalTest method testIgnoreAnnotated.

public void testIgnoreAnnotated() throws Exception {
    final FieldCanBeLocalInspection inspection = new FieldCanBeLocalInspection();
    doTestConfigured(inspection);
}
Also used : FieldCanBeLocalInspection(com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection)

Example 2 with FieldCanBeLocalInspection

use of com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection in project intellij-community by JetBrains.

the class ConvertFieldToLocalTest method configureLocalInspectionTools.

@NotNull
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
    final FieldCanBeLocalInspection inspection = new FieldCanBeLocalInspection();
    inspection.IGNORE_FIELDS_USED_IN_MULTIPLE_METHODS = false;
    return new LocalInspectionTool[] { inspection };
}
Also used : FieldCanBeLocalInspection(com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection) LocalInspectionTool(com.intellij.codeInspection.LocalInspectionTool) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with FieldCanBeLocalInspection

use of com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection in project intellij-community by JetBrains.

the class DaemonRespondToChangesTest method configureLocalInspectionTools.

@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
    if (isStressTest() && !getTestName(false).equals("TypingCurliesClearsEndOfFileErrorsInPhp_ItIsPerformanceTestBecauseItRunsTooLong")) {
        // all possible inspections
        List<InspectionToolWrapper> all = InspectionToolRegistrar.getInstance().createTools();
        List<LocalInspectionTool> locals = new ArrayList<>();
        all.stream().filter(tool -> tool instanceof LocalInspectionToolWrapper).forEach(tool -> {
            LocalInspectionTool e = ((LocalInspectionToolWrapper) tool).getTool();
            locals.add(e);
        });
        return locals.toArray(new LocalInspectionTool[locals.size()]);
    }
    return new LocalInspectionTool[] { new FieldCanBeLocalInspection(), new RequiredAttributesInspectionBase(), new CheckDtdReferencesInspection(), new AccessStaticViaInstance() };
}
Also used : TypedAction(com.intellij.openapi.editor.actionSystem.TypedAction) UIUtil(com.intellij.util.ui.UIUtil) com.intellij.testFramework(com.intellij.testFramework) VirtualFile(com.intellij.openapi.vfs.VirtualFile) THashSet(gnu.trove.THashSet) DocumentMarkupModel(com.intellij.openapi.editor.impl.DocumentMarkupModel) ApplicationEx(com.intellij.openapi.application.ex.ApplicationEx) AccessToken(com.intellij.openapi.application.AccessToken) CompletionContributor(com.intellij.codeInsight.completion.CompletionContributor) com.intellij.lang(com.intellij.lang) PerformanceWatcher(com.intellij.diagnostic.PerformanceWatcher) EditorImpl(com.intellij.openapi.editor.impl.EditorImpl) CodeFoldingManager(com.intellij.codeInsight.folding.CodeFoldingManager) RangeHighlighter(com.intellij.openapi.editor.markup.RangeHighlighter) WriteCommandAction(com.intellij.openapi.command.WriteCommandAction) EditorActionManager(com.intellij.openapi.editor.actionSystem.EditorActionManager) Module(com.intellij.openapi.module.Module) TextEditor(com.intellij.openapi.fileEditor.TextEditor) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) PlainTextFileType(com.intellij.openapi.fileTypes.PlainTextFileType) TextRange(com.intellij.openapi.util.TextRange) HighlighterTargetArea(com.intellij.openapi.editor.markup.HighlighterTargetArea) MarkupModel(com.intellij.openapi.editor.markup.MarkupModel) ConsoleView(com.intellij.execution.ui.ConsoleView) DeleteCatchFix(com.intellij.codeInsight.daemon.impl.quickfix.DeleteCatchFix) com.intellij.util(com.intellij.util) LightweightHint(com.intellij.ui.LightweightHint) ProjectManagerImpl(com.intellij.openapi.project.impl.ProjectManagerImpl) InspectionProjectProfileManager(com.intellij.profile.codeInspection.InspectionProjectProfileManager) ProperTextRange(com.intellij.openapi.util.ProperTextRange) java.util(java.util) ExternalResourceManagerExImpl(com.intellij.javaee.ExternalResourceManagerExImpl) com.intellij.openapi.editor(com.intellij.openapi.editor) LocalInspectionToolWrapper(com.intellij.codeInspection.ex.LocalInspectionToolWrapper) EditorInfo(com.intellij.codeInsight.EditorInfo) Annotator(com.intellij.lang.annotation.Annotator) ThreadDumper(com.intellij.diagnostic.ThreadDumper) InspectionToolRegistrar(com.intellij.codeInspection.ex.InspectionToolRegistrar) CoreProgressManager(com.intellij.openapi.progress.impl.CoreProgressManager) Segment(com.intellij.openapi.util.Segment) TextConsoleBuilderFactory(com.intellij.execution.filters.TextConsoleBuilderFactory) AccessStaticViaInstance(com.intellij.codeInspection.accessStaticViaInstance.AccessStaticViaInstance) JavaLanguage(com.intellij.lang.java.JavaLanguage) DebugUtil(com.intellij.psi.impl.DebugUtil) StdFileTypes(com.intellij.openapi.fileTypes.StdFileTypes) Language(org.intellij.lang.annotations.Language) StringUtil(com.intellij.openapi.util.text.StringUtil) UnusedDeclarationInspectionBase(com.intellij.codeInspection.deadCode.UnusedDeclarationInspectionBase) ProjectManagerEx(com.intellij.openapi.project.ex.ProjectManagerEx) IOException(java.io.IOException) StorageUtilKt(com.intellij.configurationStore.StorageUtilKt) AbstractIntentionAction(com.intellij.codeInsight.intention.AbstractIntentionAction) Disposable(com.intellij.openapi.Disposable) InlineRefactoringActionHandler(com.intellij.refactoring.inline.InlineRefactoringActionHandler) File(java.io.File) java.awt(java.awt) AtomicLong(java.util.concurrent.atomic.AtomicLong) RequiredAttributesInspectionBase(com.intellij.codeInspection.htmlInspections.RequiredAttributesInspectionBase) Result(com.intellij.openapi.application.Result) InspectionToolWrapper(com.intellij.codeInspection.ex.InspectionToolWrapper) UndoManager(com.intellij.openapi.command.undo.UndoManager) LocalInspectionTool(com.intellij.codeInspection.LocalInspectionTool) ApplicationManagerEx(com.intellij.openapi.application.ex.ApplicationManagerEx) SimpleDataContext(com.intellij.openapi.actionSystem.impl.SimpleDataContext) HeavyProcessLatch(com.intellij.util.io.storage.HeavyProcessLatch) CheckDtdReferencesInspection(com.intellij.xml.util.CheckDtdReferencesInspection) GutterIconRenderer(com.intellij.openapi.editor.markup.GutterIconRenderer) ExternalAnnotator(com.intellij.lang.annotation.ExternalAnnotator) HighlightSeverity(com.intellij.lang.annotation.HighlightSeverity) PsiAwareTextEditorProvider(com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorProvider) MarkupModelEx(com.intellij.openapi.editor.ex.MarkupModelEx) AnnotationHolder(com.intellij.lang.annotation.AnnotationHolder) IdeActions(com.intellij.openapi.actionSystem.IdeActions) Nls(org.jetbrains.annotations.Nls) ConsoleViewContentType(com.intellij.execution.ui.ConsoleViewContentType) ProjectManager(com.intellij.openapi.project.ProjectManager) RangeHighlighterEx(com.intellij.openapi.editor.ex.RangeHighlighterEx) SaveAndSyncHandlerImpl(com.intellij.ide.SaveAndSyncHandlerImpl) Disposer(com.intellij.openapi.util.Disposer) EditorHintListener(com.intellij.codeInsight.hint.EditorHintListener) EditorEx(com.intellij.openapi.editor.ex.EditorEx) CommonDataKeys(com.intellij.openapi.actionSystem.CommonDataKeys) Method(java.lang.reflect.Method) LightQuickFixTestCase(com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase) ProblemsHolder(com.intellij.codeInspection.ProblemsHolder) IntentionHintComponent(com.intellij.codeInsight.intention.impl.IntentionHintComponent) JavaFileType(com.intellij.ide.highlighter.JavaFileType) com.intellij.codeInsight.daemon(com.intellij.codeInsight.daemon) Collectors(java.util.stream.Collectors) com.intellij.codeHighlighting(com.intellij.codeHighlighting) Nullable(org.jetbrains.annotations.Nullable) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) List(java.util.List) ApplicationManager(com.intellij.openapi.application.ApplicationManager) GeneralSettings(com.intellij.ide.GeneralSettings) IntentionAction(com.intellij.codeInsight.intention.IntentionAction) com.intellij.psi(com.intellij.psi) NotNull(org.jetbrains.annotations.NotNull) HintListener(com.intellij.ui.HintListener) WriteAction(com.intellij.openapi.application.WriteAction) DataContext(com.intellij.openapi.actionSystem.DataContext) NonNls(org.jetbrains.annotations.NonNls) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ContainerUtil(com.intellij.util.containers.ContainerUtil) AtomicReference(java.util.concurrent.atomic.AtomicReference) FileEditorManager(com.intellij.openapi.fileEditor.FileEditorManager) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) RenameProcessor(com.intellij.refactoring.rename.RenameProcessor) InspectionProfile(com.intellij.codeInspection.InspectionProfile) IntentionManager(com.intellij.codeInsight.intention.IntentionManager) Project(com.intellij.openapi.project.Project) OpenFileDescriptor(com.intellij.openapi.fileEditor.OpenFileDescriptor) CodeInsightTestFixtureImpl(com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl) FieldCanBeLocalInspection(com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection) TextEditorProvider(com.intellij.openapi.fileEditor.impl.text.TextEditorProvider) MarkupModelListener(com.intellij.openapi.editor.impl.event.MarkupModelListener) AbstractProjectComponent(com.intellij.openapi.components.AbstractProjectComponent) CommandProcessor(com.intellij.openapi.command.CommandProcessor) UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection) FieldCanBeLocalInspection(com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection) AccessStaticViaInstance(com.intellij.codeInspection.accessStaticViaInstance.AccessStaticViaInstance) CheckDtdReferencesInspection(com.intellij.xml.util.CheckDtdReferencesInspection) RequiredAttributesInspectionBase(com.intellij.codeInspection.htmlInspections.RequiredAttributesInspectionBase) LocalInspectionToolWrapper(com.intellij.codeInspection.ex.LocalInspectionToolWrapper) InspectionToolWrapper(com.intellij.codeInspection.ex.InspectionToolWrapper) LocalInspectionTool(com.intellij.codeInspection.LocalInspectionTool) LocalInspectionToolWrapper(com.intellij.codeInspection.ex.LocalInspectionToolWrapper)

Example 4 with FieldCanBeLocalInspection

use of com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection in project intellij-community by JetBrains.

the class FieldCanBeLocalTest method testTwoMethodsNotIgnoreMultipleMethods.

public void testTwoMethodsNotIgnoreMultipleMethods() throws Exception {
    final FieldCanBeLocalInspection inspection = new FieldCanBeLocalInspection();
    inspection.IGNORE_FIELDS_USED_IN_MULTIPLE_METHODS = false;
    doTestConfigured(inspection);
}
Also used : FieldCanBeLocalInspection(com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection)

Aggregations

FieldCanBeLocalInspection (com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection)4 LocalInspectionTool (com.intellij.codeInspection.LocalInspectionTool)2 com.intellij.codeHighlighting (com.intellij.codeHighlighting)1 EditorInfo (com.intellij.codeInsight.EditorInfo)1 CompletionContributor (com.intellij.codeInsight.completion.CompletionContributor)1 com.intellij.codeInsight.daemon (com.intellij.codeInsight.daemon)1 DeleteCatchFix (com.intellij.codeInsight.daemon.impl.quickfix.DeleteCatchFix)1 LightQuickFixTestCase (com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase)1 CodeFoldingManager (com.intellij.codeInsight.folding.CodeFoldingManager)1 EditorHintListener (com.intellij.codeInsight.hint.EditorHintListener)1 AbstractIntentionAction (com.intellij.codeInsight.intention.AbstractIntentionAction)1 IntentionAction (com.intellij.codeInsight.intention.IntentionAction)1 IntentionManager (com.intellij.codeInsight.intention.IntentionManager)1 IntentionHintComponent (com.intellij.codeInsight.intention.impl.IntentionHintComponent)1 InspectionProfile (com.intellij.codeInspection.InspectionProfile)1 ProblemsHolder (com.intellij.codeInspection.ProblemsHolder)1 AccessStaticViaInstance (com.intellij.codeInspection.accessStaticViaInstance.AccessStaticViaInstance)1 UnusedDeclarationInspection (com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)1 UnusedDeclarationInspectionBase (com.intellij.codeInspection.deadCode.UnusedDeclarationInspectionBase)1 InspectionToolRegistrar (com.intellij.codeInspection.ex.InspectionToolRegistrar)1