}
}
if (!required.isEmpty()) {
throw missingAttributes(reader.getLocation(), required);
}
ModuleDependency dependency = new ModuleDependency(moduleLoader, ModuleIdentifier.create(name, slot), optional, export,
services == Disposition.IMPORT);
specBuilder.addModuleDependency(dependency);
while (reader.hasNext()) {
switch (reader.nextTag()) {
case XMLStreamConstants.END_ELEMENT: {
if (services == Disposition.EXPORT) {
// If services are to be re-exported, add META-INF/services -> true near the end of the list
dependency.addExportFilter(PathFilters.getMetaInfServicesFilter(), true);
}
if (export) {
// If re-exported, add META-INF/** -> false at the end of the list (require explicit override)
dependency.addExportFilter(PathFilters.getMetaInfSubdirectoriesFilter(), false);
dependency.addExportFilter(PathFilters.getMetaInfFilter(), false);
}
if (dependency.getImportFilters().isEmpty()) {
dependency.addImportFilter(services == Disposition.NONE ? PathFilters.getDefaultImportFilter()
: PathFilters.getDefaultImportFilterWithServices(), true);
} else {
if (services != Disposition.NONE) {
dependency.addImportFilter(PathFilters.getMetaInfServicesFilter(), true);
}
dependency.addImportFilter(PathFilters.getMetaInfSubdirectoriesFilter(), false);
dependency.addImportFilter(PathFilters.getMetaInfFilter(), false);
}
specBuilder.addModuleDependency(dependency);
return;
}
case XMLStreamConstants.START_ELEMENT: {
switch (Element.of(reader.getName())) {
case EXPORTS:
parseFilterList(reader, dependency.getExportFilters());
break;
case IMPORTS:
parseFilterList(reader, dependency.getImportFilters());
break;
default:
throw unexpectedContent(reader);
}
break;