From 2c1f8ce1ce214c7d05e2d500ee55f48e8f45bf01 Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Tue, 1 Sep 2015 00:49:24 +0300 Subject: [PATCH] Do not instantiate inspection while copying wrapper if tool is null --- .../intellij/codeInspection/ex/InspectionToolWrapper.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/platform/analysis-api/src/com/intellij/codeInspection/ex/InspectionToolWrapper.java b/platform/analysis-api/src/com/intellij/codeInspection/ex/InspectionToolWrapper.java index 779910576f5f..d6df865c7130 100644 --- a/platform/analysis-api/src/com/intellij/codeInspection/ex/InspectionToolWrapper.java +++ b/platform/analysis-api/src/com/intellij/codeInspection/ex/InspectionToolWrapper.java @@ -60,13 +60,9 @@ public abstract class InspectionToolWrapper other) { myEP = other.myEP; // we need to create a copy for buffering - if (myEP != null) { + if (other.myTool != null) { //noinspection unchecked - myTool = (T)myEP.instantiateTool(); - } - else if (other.myTool != null) { - //noinspection unchecked - myTool = (T)InspectionToolsRegistrarCore.instantiateTool(other.myTool.getClass()); + myTool = myEP != null ? (T)myEP.instantiateTool() : (T)InspectionToolsRegistrarCore.instantiateTool(other.myTool.getClass()); } else { myTool = null;