private static AnAction @NotNull [] getActions(@NotNull ActionGroup group, @NotNull ActionManager actionManager) {
    try {
      if (group instanceof ActionGroupStub stub) {
        AnAction[] stubChildren = stub.getChildActionsOrStubs();
        if (stubChildren.length > 0) return stubChildren;
        String actionId = stub.getId();
        LOG.info("No children in '" + actionId + "' stub. Creating its instance");
        AnAction unstubbed = actionManager.getAction(actionId);
        if (unstubbed instanceof ActionGroup g && !(unstubbed instanceof ActionGroupStub)) {
          return getActions(g, actionManager);
        }
        else {
          PluginException.logPluginError(LOG, "'" + actionId + "' is not an action group. " +
                                              unstubbed.getClass().getName(), null, unstubbed.getClass());
          return AnAction.EMPTY_ARRAY;
        }
      }
      else if (group instanceof DefaultActionGroup g && ActionClassMetaData.isDefaultGetChildren(g)) {
        return g.getChildActionsOrStubs();
      }
      else {
        return group.getChildren(null);
      }
    }
    catch (Throwable e) {
      return AnAction.EMPTY_ARRAY;
    }
  }
private static AnAction @NotNull [] getActions(@NotNull ActionGroup group, @NotNull ActionManager actionManager)