Do not instantiate inspection while copying wrapper if tool is null

This commit is contained in:
Alexander Zolotov
2015-09-01 01:01:20 +03:00
parent 1d18d9933c
commit 2c1f8ce1ce
@@ -60,13 +60,9 @@ public abstract class InspectionToolWrapper<T extends InspectionProfileEntry, E
protected InspectionToolWrapper(@NotNull InspectionToolWrapper<T, E> 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;