private @NotNull Object /* TerminalContainer | Splitter */ validateAndGetChild() {
      Component[] children = getComponents();
      if (children.length != 1) {
        throw new IllegalStateException("Expected 1 child, but got " + children.length + ": " + Arrays.toString(children));
      }
      Component child = Objects.requireNonNull(children[0]);
      if (myTerminal != null) {
        if (child == myTerminal.myTerminalWidget.getComponent()) {
          return myTerminal;
        }
        throw new IllegalStateException("Expected terminal widget (" + myTerminal.myTerminalWidget.getComponent() + "), got " + child);
      }
      else {
        if (child instanceof Splitter splitter) {
          return splitter;
        }
        throw new IllegalStateException("Expected splitter, got " + child);
      }
    }
private @NotNull Object /* TerminalContainer | Splitter */ validateAndGetChild()