docs: protected void validate( JcrNodeType nodeType,
                               List<JcrNodeType> supertypes,
                               List<JcrNodeType> pendingTypes ) throws RepositoryException {
          validateSupertypes(supertypes);
  
          List<Name> supertypeNames = new ArrayList<Name>(supertypes.size());
          for (JcrNodeType supertype : supertypes) {
              supertypeNames.add(supertype.getInternalName());
          }
  
          boolean foundExact = false;
          boolean foundResidual = false;
          boolean foundSNS = false;
          Name primaryItemName = nodeType.getInternalPrimaryItemName();
  
          for (JcrNodeDefinition node : nodeType.getDeclaredChildNodeDefinitions()) {
              validateChildNodeDefinition(node, supertypeNames, pendingTypes);
              if (node.isResidual()) {
                  foundResidual = true;
              }
  
              if (primaryItemName != null && primaryItemName.equals(node.getInternalName())) {
                  foundExact = true;
              }
              
              if (node.allowsSameNameSiblings()) {
                  foundSNS = true;
              }
          }
  
          for (JcrPropertyDefinition prop : nodeType.getDeclaredPropertyDefinitions()) {
              validatePropertyDefinition(prop, supertypeNames, pendingTypes);
              if (prop.isResidual()) {
                  foundResidual = true;
              }
              if (primaryItemName != null && primaryItemName.equals(prop.getInternalName())) {
                  if (foundExact) {
                      throw new RepositoryException(JcrI18n.ambiguousPrimaryItemName.text(primaryItemName));
                  }
                  foundExact = true;
              }
          }
  
          if (primaryItemName != null && !foundExact && !foundResidual) {
              throw new RepositoryException(JcrI18n.invalidPrimaryItemName.text(primaryItemName));
          }
  
          Name internalName = nodeType.getInternalName();
          if (isUnorderedCollection(internalName, supertypeNames)) {
              boolean isVersionable = isVersionable(internalName, supertypeNames);
              if (isVersionable || foundSNS || nodeType.hasOrderableChildNodes()) {
                  throw new RepositoryException(JcrI18n.invalidUnorderedCollectionType.text(internalName.toString()));
              }
          }
      }