private synchronized <T extends InspectionTreeNode> T getOrAdd(Object userObject,
                                                                 InspectionTreeNode parent,
                                                                 @NotNull Supplier<? extends @NotNull T> supplier) {
    ApplicationManager.getApplication().assertIsNonDispatchThread();
    if (userObject == null) {
      userObject = ObjectUtils.NULL;
    }
    InspectionTreeNode.Children children = parent.myChildren;
    if (children == null) {
      parent.myChildren = children = new InspectionTreeNode.Children();
    }
    InspectionTreeNode node = children.myUserObject2Node.get(userObject);
    if (node == null) {
      node = supplier.get();
      InspectionTreeNode finalNode = node;
      InspectionTreeNode.Children finalChildren = children;
      int idx = ReadAction.compute(() -> Arrays.binarySearch(finalChildren.myChildren, finalNode, InspectionResultsViewComparator.INSTANCE));
      // it's allowed to have idx >= 0 for example for problem descriptor nodes.
      int insertionPoint = idx >= 0 ? idx : -idx - 1;
      children.myChildren = ArrayUtil.insert(children.myChildren, insertionPoint, node);
      children.myUserObject2Node.put(userObject, node);

      LOG.assertTrue(children.myChildren.length == children.myUserObject2Node.size());

      if (node instanceof SuppressableInspectionTreeNode) {
        ((SuppressableInspectionTreeNode)node).nodeAdded();
      }

      TreePath path = TreePathUtil.pathToTreeNode(node);
      TreePath parentPath = path.getParentPath();
      treeNodesInserted(parentPath, null, null);
      while (parentPath != null) {
        treeStructureChanged(parentPath, null, null);
        parentPath = parentPath.getParentPath();
        if (parentPath == null || parentPath.getLastPathComponent() == myRoot) {
          break;
        }
      }
    }
    //noinspection unchecked
    return (T)node;
  }
private synchronized <T extends InspectionTreeNode> T getOrAdd(Object userObject,
                                                                 InspectionTreeNode parent,
                                                                 @NotNull Supplier<? extends @NotNull T> supplier)