code: protected List<String> initializeModeRecursive(CliModeContainer mode) {
  
      InitializationState state = mode.getState();
      if (!state.isInitialized()) {
        if (state.isInitializing()) {
          // cycle detected
          List<String> cycle = new ArrayList<>();
          cycle.add(mode.getId());
          return cycle;
        } else {
          state.setInitializing();
        }
        for (String parentId : mode.getMode().parentIds()) {
          CliModeContainer parentContainer = this.id2ModeMap.get(parentId);
          if (parentContainer == null) {
            throw new ObjectNotFoundException(CliMode.class, parentId);
          }
          List<String> cycle = initializeModeRecursive(parentContainer);
          if (cycle != null) {
            cycle.add(mode.getId());
            return cycle;
          }
          mode.getExtendedModes().addAll(parentContainer.getExtendedModes());
        }
        state.setInitialized();
      }
      return null;
    }
docs: This method initializes the given {@link CliModeContainer}.
  
  @param mode is the {@link CliModeContainer} to initialize.
  @return a {@link List} of {@link CliModeContainer#getId() CLI mode IDs} (in reverse order) of a cyclic dependency
  that was detected, or {@code null} if the initialization was successful.