void (@Nullable Project project) { SchemeDataHolder<? super InspectionProfileImpl> dataHolder = myDataHolder; if (dataHolder != null) { myDataHolder = null; Element element = dataHolder.read(); if (element.getName().equals("component")) { element = element.getChild("profile"); } assert element != null; readExternal(element); } if (myBaseProfile != null) { myBaseProfile.initInspectionTools(); } List<InspectionToolWrapper<?, ?>> tools; try { tools = createTools(project); } catch (ProcessCanceledException ignored) { return; } Map<String, List<String>> dependencies = new HashMap<>(); for (InspectionToolWrapper<?, ?> toolWrapper : tools) { addTool(project, toolWrapper, dependencies); if (toolWrapper instanceof LocalInspectionToolWrapper && ((LocalInspectionToolWrapper)toolWrapper).isDynamicGroup() && // some settings were read for the tool, so it must be initialized, otherwise no dynamic tools are expected toolWrapper.isInitialized()) { ToolsImpl parent = myTools.get(toolWrapper.getShortName()); if (parent.isEnabled()) { var children = ((DynamicGroupTool)toolWrapper.getTool()).getChildren(); var childNames = children.stream().map(LocalInspectionToolWrapper::getShortName).collect(Collectors.toSet()); //noinspection SSBasedInspection if (tools.stream().noneMatch(tool -> childNames.contains(tool.getShortName()))) { boolean isLocked = myLockedProfile; myLockedProfile = false; for (LocalInspectionToolWrapper wrapper : children) { addTool(project, wrapper, dependencies); String shortName = wrapper.getShortName(); if (InspectionElementsMerger.getMerger(shortName) == null) { InspectionElementsMerger.addMerger(shortName, new MyInspectionElementsMerger(shortName, wrapper)); } } myLockedProfile = isLocked; } } } } // initialize is invoked in synchronized block, so we can publish the new value of myDisposable here myDisposable = project != null ? Disposer.newDisposable(project, "[" + getClass().getSimpleName() + "] " + getName()) : null; myToolSupplier.addListener(new InspectionToolsSupplier.Listener() { @Override public void toolAdded(@NotNull InspectionToolWrapper<?,?> inspectionTool) { addTool(project, inspectionTool, null); myProfileManager.fireProfileChanged(InspectionProfileImpl.this); } @Override public void toolRemoved(@NotNull InspectionToolWrapper<?,?> inspectionTool) { removeTool(inspectionTool); myProfileManager.fireProfileChanged(InspectionProfileImpl.this); } }, myDisposable); copyToolsConfigurations(project); myInitialized = true; if (dataHolder != null) { // should be only after set myInitialized dataHolder.updateDigest(this); } }