public void collectFailures(FailureState failureState) {
   ModuleVersionResolveException failure = getFailure();
   if (failure != null) {
     failureState.addUnresolvedDependency(
         this, selector.dependencyMetaData.getRequested(), failure);
   }
 }
  /** Populates the result from the graph traversal state. */
  private void assembleResult(
      ResolveState resolveState,
      ResolvedConfigurationBuilder result,
      ResolvedConfigurationListener listener) {
    FailureState failureState = new FailureState(resolveState.root);
    ModuleVersionIdentifier root = resolveState.root.toId();
    listener.start(root);

    for (ConfigurationNode resolvedConfiguration : resolveState.getConfigurationNodes()) {
      if (resolvedConfiguration.isSelected()) {
        resolvedConfiguration.attachToParents(result);
        resolvedConfiguration.collectFailures(failureState);
        listener.resolvedModuleVersion(resolvedConfiguration.moduleRevision);
      }
    }
    for (ConfigurationNode resolvedConfiguration : resolveState.getConfigurationNodes()) {
      if (resolvedConfiguration.isSelected()) {
        listener.resolvedConfiguration(
            resolvedConfiguration.toId(), resolvedConfiguration.outgoingEdges);
      }
    }
    failureState.attachFailures(result);
    result.done(resolveState.root.getResult());
  }