docs: private KeyScope resolveIntermediate(final KeyScope scope) {
          final Map<String, KeyDef> keys = new HashMap<>(scope.keyDefinition);
          for (final Map.Entry<String, KeyDef> e: scope.keyDefinition.entrySet()) {
              final KeyDef res = resolveIntermediate(scope, e.getValue(), Collections.singletonList(e.getValue()));
              keys.put(e.getKey(), res);
          }
          final List<KeyScope> children = new ArrayList<>();
          for (final KeyScope child: scope.childScopes) {
              final KeyScope resolvedChild = resolveIntermediate(child);
              children.add(resolvedChild);
          }
          return new KeyScope(scope.id, scope.name, keys, children);
      }