global inspections: proceed with suspicious usages for unused declaration inspection (IDEA-151971)

This commit is contained in:
Anna Kozlova
2016-02-24 21:05:13 +01:00
parent 6e9234b115
commit 4321968124
@@ -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<InspectionToolWrapper> needRepeatSearchRequest = new ArrayList<InspectionToolWrapper>();
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);
}