use of dagger.spi.model.BindingKind.INJECTION in project dapper by jbock-java.
the class IncompatiblyScopedBindingsValidator method visitGraph.
@Override
public void visitGraph(BindingGraph bindingGraph, DiagnosticReporter diagnosticReporter) {
DiagnosticMessageGenerator diagnosticMessageGenerator = diagnosticMessageGeneratorFactory.create(bindingGraph);
ImmutableSetMultimap.Builder<ComponentNode, dagger.spi.model.Binding> incompatibleBindings = ImmutableSetMultimap.builder();
for (dagger.spi.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)) {
// properly scoped ancestor component, so ignore them here.
if (binding.kind().equals(INJECTION) && (bindingGraph.rootComponentNode().isSubcomponent() || !bindingGraph.rootComponentNode().isRealComponent())) {
return;
}
incompatibleBindings.put(componentNode, binding);
}
});
}
Multimaps.asMap(incompatibleBindings.build()).forEach((componentNode, bindings) -> report(componentNode, bindings, diagnosticReporter, diagnosticMessageGenerator));
}
use of dagger.spi.model.BindingKind.INJECTION in project DaggerCodeParse-2.38.1base by hellogaod.
the class IncompatiblyScopedBindingsValidator method visitGraph.
@Override
public void visitGraph(BindingGraph bindingGraph, DiagnosticReporter diagnosticReporter) {
ImmutableSetMultimap.Builder<BindingGraph.ComponentNode, dagger.spi.model.Binding> incompatibleBindings = ImmutableSetMultimap.builder();
for (dagger.spi.model.Binding binding : bindingGraph.bindings()) {
binding.scope().filter(scope -> !scope.isReusable()).ifPresent(scope -> {
BindingGraph.ComponentNode componentNode = bindingGraph.componentNode(binding.componentPath()).get();
if (!componentNode.scopes().contains(scope)) {
// properly scoped ancestor component, so ignore them here.
if (binding.kind().equals(INJECTION) && (bindingGraph.rootComponentNode().isSubcomponent() || !bindingGraph.rootComponentNode().isRealComponent())) {
return;
}
incompatibleBindings.put(componentNode, binding);
}
});
}
Multimaps.asMap(incompatibleBindings.build()).forEach((componentNode, bindings) -> report(componentNode, bindings, diagnosticReporter));
}
Aggregations