class DefaultDependencyResolver implements DependencyResolver {

    @Override
    public List<Node> flatten(Session s, Node node, PathScope scope) throws DependencyResolverException {
        InternalSession session = InternalSession.from(s);
        DependencyNode root = cast(AbstractNode.class, node, "node").getDependencyNode();
        List<DependencyNode> dependencies = session.getRepositorySystem()
                .flattenDependencyNodes(session.getSession(), root, getScopeDependencyFilter(scope));
        dependencies.remove(root);
        return map(dependencies, session::getNode);
    }

    private static DependencyFilter getScopeDependencyFilter(PathScope scope) {
        Set<String> scopes =
                scope.dependencyScopes().stream().map(DependencyScope::id).collect(Collectors.toSet());
        return (n, p) -> {
            org.eclipse.aether.graph.Dependency d = n.getDependency();
            return d == null || scopes.contains(d.getScope());
        };
    }

    /**
     * Collects, flattens and resolves the dependencies.
     *
     * @param request the request to resolve
     * @return the result of the resolution
     */
    @Override
    public DependencyResolverResult resolve(DependencyResolverRequest request)
            throws DependencyCollectorException, DependencyResolverException, ArtifactResolverException {<FILL_FUNCTION_BODY>}

    private static DependencyResolverException cannotReadModuleInfo(final Path path, final IOException cause) {
        return new DependencyResolverException("Cannot read module information of " + path, cause);
    }
}

        InternalSession session =
                InternalSession.from(nonNull(request, "request").getSession());
        Predicate<PathType> filter = request.getPathTypeFilter();
        PathModularizationCache cache = new PathModularizationCache(); // TODO: should be project-wide cache.
        DependencyCollectorResult collectorResult =
                session.getService(DependencyCollector.class).collect(request);
        List<Node> nodes = flatten(session, collectorResult.getRoot(), request.getPathScope());
        List<ArtifactCoordinate> coordinates = nodes.stream()
                .map(Node::getDependency)
                .filter(Objects::nonNull)
                .map(Artifact::toCoordinate)
                .collect(Collectors.toList());
        Map<Artifact, Path> artifacts = session.resolveArtifacts(coordinates);
        DefaultDependencyResolverResult result = new DefaultDependencyResolverResult(
                collectorResult.getExceptions(), collectorResult.getRoot(), nodes.size());
        for (Node node : nodes) {
            Dependency d = node.getDependency();
            Path path = (d != null) ? artifacts.get(d) : null;
            try {
                result.addDependency(node, d, filter, path, cache);
            } catch (IOException e) {
                throw cannotReadModuleInfo(path, e);
            }
        }
        return result;
    
<no_super_class>