From 432196812453cb0f9d1685452a038ed39bd2bf2a Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Wed, 24 Feb 2016 19:14:38 +0100 Subject: [PATCH] global inspections: proceed with suspicious usages for unused declaration inspection (IDEA-151971) --- .../codeInspection/ex/GlobalInspectionContextImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 8f989c674963..935ef03fefd6 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java @@ -598,7 +598,7 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp LOG.assertTrue(!ApplicationManager.getApplication().isReadAccessAllowed() || isOfflineInspections, "Must not run under read action, too unresponsive"); final List needRepeatSearchRequest = new ArrayList(); - final boolean canBeExternalUsages = scope.getScopeType() != AnalysisScope.PROJECT; + final boolean canBeExternalUsages = !(scope.getScopeType() == AnalysisScope.PROJECT && scope.isIncludeTestSource()); for (Tools tools : globalTools) { for (ScopeToolState state : tools.getTools()) { final InspectionToolWrapper toolWrapper = state.getTool(); @@ -618,8 +618,8 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp @Override public void run() { tool.runInspection(scope, inspectionManager, GlobalInspectionContextImpl.this, toolPresentation); - //skip phase when we are sure that scope already contains everything - if (canBeExternalUsages && + //skip phase when we are sure that scope already contains everything, unused declaration though needs to proceed with its suspicious code + if ((canBeExternalUsages || tool.getAdditionalJobs() != null) && tool.queryExternalUsagesRequests(inspectionManager, GlobalInspectionContextImpl.this, toolPresentation)) { needRepeatSearchRequest.add(toolWrapper); }