TypeElement componentContainingEntryPoint(DependencyEdge entryPoint) { return source(entryPoint).componentPath().currentComponent(); }
DiagnosticReporterImpl(BindingGraph graph, String plugin) { this.graph = graph; this.plugin = plugin; this.rootComponent = graph.rootComponentNode().componentPath().currentComponent(); }
private String missingBindingErrorMessage(MissingBinding missingBinding, BindingGraph graph) { Key key = missingBinding.key(); StringBuilder errorMessage = new StringBuilder(); // Wildcards should have already been checked by DependencyRequestValidator. verify(!key.type().getKind().equals(TypeKind.WILDCARD), "unexpected wildcard request: %s", key); // TODO(ronshapiro): replace "provided" with "satisfied"? errorMessage.append(key).append(" cannot be provided without "); if (isValidImplicitProvisionKey(key, types)) { errorMessage.append("an @Inject constructor or "); } errorMessage.append("an @Provides-"); // TODO(dpb): s/an/a if (allIncomingDependenciesCanUseProduction(missingBinding, graph)) { errorMessage.append(" or @Produces-"); } errorMessage.append("annotated method."); if (isValidMembersInjectionKey(key) && typeHasInjectionSites(key)) { errorMessage.append( " This type supports members injection but cannot be implicitly provided."); } graph.bindings(key).stream() .map(binding -> binding.componentPath().currentComponent()) .distinct() .forEach( component -> errorMessage .append("\nA binding with matching key exists in component: ") .append(component.getQualifiedName())); return errorMessage.toString(); }
private void reportMissingModuleParameters( ChildFactoryMethodEdge edge, ImmutableSet<TypeElement> missingModules, BindingGraph graph, DiagnosticReporter diagnosticReporter) { diagnosticReporter.reportSubcomponentFactoryMethod( ERROR, edge, "%s requires modules which have no visible default constructors. " + "Add the following modules as parameters to this method: %s", graph .network() .incidentNodes(edge) .target() .componentPath() .currentComponent() .getQualifiedName(), Joiner.on(", ").join(missingModules)); } }
Diagnostic.Kind diagnosticKind = ERROR; StringBuilder message = new StringBuilder(componentNode.componentPath().currentComponent().getQualifiedName());
private ResolvedBindings resolvedDependencies( Node source, DependencyRequest dependencyRequest) { return componentTreePath() .pathFromRootToAncestor(source.componentPath().currentComponent()) .currentGraph() .resolvedBindings(bindingRequest(dependencyRequest)); }
private ImmutableSet<TypeElement> subgraphFactoryMethodParameters( ChildFactoryMethodEdge edge, BindingGraph bindingGraph) { ComponentNode parent = (ComponentNode) bindingGraph.network().incidentNodes(edge).source(); DeclaredType parentType = asDeclared(parent.componentPath().currentComponent().asType()); ExecutableType factoryMethodType = asExecutable(types.asMemberOf(parentType, edge.factoryMethod())); return asTypeElements(factoryMethodType.getParameterTypes()); }