if (dependencies == null || dependencies.isEmpty())
return;
for (RequirementDependencyItem item : dependencies)
{
Requirement requirement = item.getRequirement();
// If we are looking at everything or this is a re-export
if (reExport == false || requirement.isReExport())
{
// Sanity checks
if (item.isResolved() == false)
throw new IllegalStateException("Item not resolved: " + item);
// Dynamic requirement, create it lazily
if (requirement.isDynamic())
{
DelegateLoader delegate = createLazyDelegateLoader(checkDomain(), item);
dynamic.add(delegate);
continue;
}
String name = (String) item.getIDependOn();
if (name == null)
{
// Optional requirement, just ignore
if (requirement.isOptional())
continue;
// Something has gone wrong
throw new IllegalStateException("No iDependOn for item: " + item);
}
Module iDependOnModule = checkDomain().getModule(name);
if (iDependOnModule == null)
throw new IllegalStateException("Module not found with name: " + name);
// Determine the delegate loader for the module
Module other = item.getModule();
DelegateLoader delegate = iDependOnModule.getDelegateLoader(other, requirement);
// Check for re-export by the module
if (requirement.wantReExports())
addDelegates(iDependOnModule, delegates, dynamic, visited, true);
// We want a module's re-exports (i.e. part of its imports) before the module itself
if (delegate != null)
delegates.add(delegate);