ModuleLoader moduleLoader = Module.getBootModuleLoader();
result = new HashSet<Capability>();
String symbolicName = (String) requirement.getAttribute(IdentityNamespace.IDENTITY_NAMESPACE);
VersionRange versionRange = (VersionRange) requirement.getAttribute(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);
// Find the module versions that match
File moduleDir = new File(modulesDir, symbolicName.replace(".", File.separator));
if (versionRange != null && moduleDir.isDirectory()) {
for (File file : moduleDir.listFiles()) {
if (!file.isDirectory() || file.getName().equals("main")) {
continue;
}
Version version;
try {
version = new Version(file.getName());
} catch (Throwable th) {
continue;
}
if (!versionRange.includes(version)) {
continue;
}
String modname = symbolicName + ":" + version;
ModuleIdentifier modid = ModuleIdentifier.fromString(modname);
try {