} else {
nestedFilters = filterStack.clone();
nestedFilters.add(importFilter);
nestedFilters.add(exportFilter);
}
final ClassFilter classImportFilter = dependency.getClassImportFilter();
final ClassFilter classExportFilter = dependency.getClassExportFilter();
if ((classImportFilter == ClassFilters.acceptAll() || classFilterStack.contains(classImportFilter)) && (classExportFilter == ClassFilters.acceptAll() || classFilterStack.contains(classExportFilter))) {
nestedClassFilters = classFilterStack;
} else {
nestedClassFilters = classFilterStack.clone();
if (classImportFilter != ClassFilters.acceptAll()) nestedClassFilters.add(classImportFilter);
if (classExportFilter != ClassFilters.acceptAll()) nestedClassFilters.add(classExportFilter);
}
final PathFilter resourceImportFilter = dependency.getResourceImportFilter();
final PathFilter resourceExportFilter = dependency.getResourceExportFilter();
if ((resourceImportFilter == PathFilters.acceptAll() || resourceFilterStack.contains(resourceImportFilter)) && (resourceExportFilter == PathFilters.acceptAll() || resourceFilterStack.contains(resourceExportFilter))) {
nestedResourceFilters = resourceFilterStack;
} else {
nestedResourceFilters = resourceFilterStack.clone();
if (resourceImportFilter != PathFilters.acceptAll()) nestedResourceFilters.add(resourceImportFilter);
if (resourceExportFilter != PathFilters.acceptAll()) nestedResourceFilters.add(resourceExportFilter);
}
subtract += module.addExportedPaths(module.getDependenciesInternal(), map, nestedFilters, nestedClassFilters, nestedResourceFilters, visited);
} else if (dependency instanceof ModuleClassLoaderDependency) {
final ModuleClassLoaderDependency classLoaderDependency = (ModuleClassLoaderDependency) dependency;
LocalLoader localLoader = classLoaderDependency.getLocalLoader();
for (Object filter : classFilterStack.getRawArray()) {
if (filter != null && filter != ClassFilters.acceptAll()) {
localLoader = createClassFilteredLocalLoader((ClassFilter) filter, localLoader);
}
}
for (Object filter : resourceFilterStack.getRawArray()) {
if (filter != null && filter != PathFilters.acceptAll()) {
localLoader = createPathFilteredLocalLoader((PathFilter) filter, localLoader);
}
}
ClassFilter classImportFilter = classLoaderDependency.getClassImportFilter();
if (classImportFilter != ClassFilters.acceptAll()) {
localLoader = createClassFilteredLocalLoader(classImportFilter, localLoader);
}
ClassFilter classExportFilter = classLoaderDependency.getClassExportFilter();
if (classExportFilter != ClassFilters.acceptAll()) {
localLoader = createClassFilteredLocalLoader(classExportFilter, localLoader);
}
PathFilter resourceImportFilter = classLoaderDependency.getResourceImportFilter();
if (resourceImportFilter != PathFilters.acceptAll()) {
localLoader = createPathFilteredLocalLoader(resourceImportFilter, localLoader);
}
PathFilter resourceExportFilter = classLoaderDependency.getResourceExportFilter();
if (resourceExportFilter != PathFilters.acceptAll()) {
localLoader = createPathFilteredLocalLoader(resourceExportFilter, localLoader);
}
final PathFilter importFilter = classLoaderDependency.getImportFilter();
final Set<String> paths = classLoaderDependency.getPaths();
for (String path : paths) {
boolean accept = ! "_private".equals(path);
if (accept) for (Object filter : filterStack.getRawArray()) {
if (filter != null && ! ((PathFilter)filter).accept(path)) {
accept = false; break;
}
}
if (accept && importFilter.accept(path) && exportFilter.accept(path)) {
List<LocalLoader> list = map.get(path);
if (list == null) {
map.put(path, list = new ArrayList<LocalLoader>(1));
list.add(localLoader);
} else if (! list.contains(localLoader)) {
list.add(localLoader);
}
}
}
} else if (dependency instanceof LocalDependency) {
final LocalDependency localDependency = (LocalDependency) dependency;
LocalLoader localLoader = localDependency.getLocalLoader();
for (Object filter : classFilterStack.getRawArray()) {
if (filter != null && filter != ClassFilters.acceptAll()) {
localLoader = createClassFilteredLocalLoader((ClassFilter) filter, localLoader);
}
}
for (Object filter : resourceFilterStack.getRawArray()) {
if (filter != null && filter != PathFilters.acceptAll()) {
localLoader = createPathFilteredLocalLoader((PathFilter) filter, localLoader);
}
}
ClassFilter classFilter = localDependency.getClassExportFilter();
if (classFilter != ClassFilters.acceptAll()) {
localLoader = createClassFilteredLocalLoader(classFilter, localLoader);
}
classFilter = localDependency.getClassImportFilter();
if (classFilter != ClassFilters.acceptAll()) {