docs: protected List<JcrNodeType> supertypesFor( NodeTypeDefinition nodeType,
                                                 Collection<JcrNodeType> pendingTypes ) throws RepositoryException {
          assert nodeType != null;
  
          List<JcrNodeType> supertypes = new LinkedList<JcrNodeType>();
  
          boolean isMixin = nodeType.isMixin();
          boolean needsPrimaryAncestor = !isMixin;
          String nodeTypeName = nodeType.getName();
  
          for (String supertypeNameStr : nodeType.getDeclaredSupertypeNames()) {
              Name supertypeName = nameFactory.create(supertypeNameStr);
              JcrNodeType supertype = findTypeInMapOrList(supertypeName, pendingTypes);
              if (supertype == null) {
                  throw new InvalidNodeTypeDefinitionException(JcrI18n.invalidSupertypeName.text(supertypeNameStr, nodeTypeName));
              }
              needsPrimaryAncestor &= supertype.isMixin();
              supertypes.add(supertype);
          }
  
          // primary types (other than nt:base) always have at least one ancestor that's a primary type - nt:base
          if (needsPrimaryAncestor) {
              Name nodeName = nameFactory.create(nodeTypeName);
              if (!JcrNtLexicon.BASE.equals(nodeName)) {
                  JcrNodeType ntBase = findTypeInMapOrList(JcrNtLexicon.BASE, pendingTypes);
                  assert ntBase != null;
                  supertypes.add(0, ntBase);
              }
          }
          return supertypes;
      }