Merge remote-tracking branch 'origin/master'

This commit is contained in:
Alexey Utkin
2017-08-09 12:20:29 +03:00
2 changed files with 12 additions and 5 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -18,12 +18,15 @@ package com.intellij.codeInspection.ex;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.reference.RefGraphAnnotator;
import com.intellij.codeInspection.reference.RefManagerImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ObjectUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class GlobalInspectionToolWrapper extends InspectionToolWrapper<GlobalInspectionTool, InspectionEP> {
private static final Logger LOG = Logger.getInstance(GlobalInspectionToolWrapper.class);
public GlobalInspectionToolWrapper(@NotNull GlobalInspectionTool globalInspectionTool) {
super(globalInspectionTool);
}
@@ -84,6 +87,7 @@ public class GlobalInspectionToolWrapper extends InspectionToolWrapper<GlobalIns
public LocalInspectionToolWrapper getSharedLocalInspectionToolWrapper() {
final LocalInspectionTool sharedTool = getTool().getSharedLocalInspectionTool();
if (sharedTool == null) {
LOG.assertTrue(!isCleanupTool(), "Global cleanup tool MUST have shared local tool");
return null;
}
//noinspection TestOnlyProblems
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -939,7 +939,7 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
}
final Iterable<Tools> inspectionTools = ContainerUtil.filter(profile.getAllEnabledInspectionTools(getProject()), tools -> {
assert tools != null;
return tools.getTool().getTool() instanceof CleanupLocalInspectionTool;
return tools.getTool().isCleanupTool();
});
boolean includeDoNotShow = includeDoNotShow(profile);
final RefManagerImpl refManager = (RefManagerImpl)getRefManager();
@@ -957,8 +957,11 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
if (isBinary(file)) return;
final List<LocalInspectionToolWrapper> lTools = new ArrayList<>();
for (final Tools tools : inspectionTools) {
final InspectionToolWrapper tool = tools.getEnabledTool(file, includeDoNotShow);
if (tool instanceof LocalInspectionToolWrapper) {
InspectionToolWrapper tool = tools.getEnabledTool(file, includeDoNotShow);
if (tool instanceof GlobalInspectionToolWrapper) {
tool = ((GlobalInspectionToolWrapper)tool).getSharedLocalInspectionToolWrapper();
}
if (tool != null) {
lTools.add((LocalInspectionToolWrapper)tool);
tool.initialize(GlobalInspectionContextImpl.this);
}