docs: @SuppressWarnings("unchecked")
    private static ManagedPartitionService buildPartitionService(
        AtomixConfig config,
        ClusterMembershipService clusterMembershipService,
        ClusterCommunicationService messagingService,
        AtomixRegistry registry) {
      List<ManagedPartitionGroup> partitionGroups = new ArrayList<>();
      for (PartitionGroupConfig<?> partitionGroupConfig : config.getPartitionGroups().values()) {
        partitionGroups.add(partitionGroupConfig.getType().newPartitionGroup(partitionGroupConfig));
      }
  
      return new DefaultPartitionService(
          clusterMembershipService,
          messagingService,
          new DefaultPrimitiveTypeRegistry(registry.getTypes(PrimitiveType.class)),
          buildSystemPartitionGroup(config),
          partitionGroups,
          new DefaultPartitionGroupTypeRegistry(registry.getTypes(PartitionGroup.Type.class)));
    }