private Function<ComponentNode, Set<TypeElement>> uncachedInheritedModules(BindingGraph graph) { return componentNode -> componentNode.componentPath().atRoot() ? ImmutableSet.of() : graph .componentNode(componentNode.componentPath().parent()) .map(parent -> union(ownedModules(parent, graph), inheritedModules(parent, graph))) .get(); }
private ImmutableList<Node> shortestPathToCycleFromAnEntryPoint( Cycle<Node> cycle, BindingGraph bindingGraph) { Node someCycleNode = cycle.nodes().asList().get(0); ComponentNode componentContainingCycle = bindingGraph.componentNode(someCycleNode.componentPath()).get(); ImmutableList<Node> pathToCycle = shortestPath(bindingGraph.network(), componentContainingCycle, someCycleNode); return subpathToCycle(pathToCycle, cycle); }
diagnosticReporter.reportComponent( ERROR, bindingGraph.componentNode(cycle.nodes().asList().get(0).componentPath()).get(), errorMessage(cycle, bindingGraph)); return;
@Override public void visitGraph(BindingGraph bindingGraph, DiagnosticReporter diagnosticReporter) { ImmutableSetMultimap.Builder<ComponentNode, dagger.model.Binding> incompatibleBindings = ImmutableSetMultimap.builder(); for (dagger.model.Binding binding : bindingGraph.bindings()) { binding .scope() .filter(scope -> !scope.isReusable()) .ifPresent( scope -> { ComponentNode componentNode = bindingGraph.componentNode(binding.componentPath()).get(); if (!componentNode.scopes().contains(scope)) { // @Inject bindings in module binding graphs will appear at the properly scoped // ancestor component, so ignore them here. if (binding.kind().equals(INJECTION) && bindingGraph.isModuleBindingGraph()) { return; } incompatibleBindings.put(componentNode, binding); } }); } Multimaps.asMap(incompatibleBindings.build()) .forEach( (componentNode, bindings) -> report(componentNode, bindings, bindingGraph, diagnosticReporter)); }