Set<ServiceDef2> moduleServiceDefs = CollectionFactory.newSet();
for (String serviceId : def.getServiceIds())
{
ServiceDef2 serviceDef = module.getServiceDef(serviceId);
moduleServiceDefs.add(serviceDef);
allServiceDefs.add(serviceDef);
Module existing = serviceIdToModule.get(serviceId);
if (existing != null)
throw new RuntimeException(IOCMessages.serviceIdConflict(serviceId,
existing.getServiceDef(serviceId), serviceDef));
serviceIdToModule.put(serviceId, module);
// The service is defined but will not have gone further than that.
tracker.define(serviceDef, Status.DEFINED);
for (Class marker : serviceDef.getMarkers())
InternalUtils.addToMapList(markerToServiceDef, marker, serviceDef);
}
moduleToServiceDefs.put(module, moduleServiceDefs);
}