// interface.
for (MethodLiteral<?, Method> method :
constructorInjectCollector.getMethods(ginjectorInterface)) {
Key<?> methodKey = guiceUtil.getKey(method);
Binding binding = bindings.getBinding(methodKey);
if (binding == null) {
// This should not happen, but fail with a meaningful message if it
// does.
logger.log(TreeLogger.Type.ERROR, "Unable to find a binding for the required key "
+ methodKey);
throw new UnableToCompleteException();
}
if (!reachabilityAnalyzer.isReachable(binding)) {
// Sanity-check reachability: every binding in the Ginjector ought to be
// reachable.
PrettyPrinter.log(logger, TreeLogger.Type.ERROR,
"The key %s is required by the Ginjector, but is not reachable.", methodKey);
throw new UnableToCompleteException();
}
FragmentPackageName fragmentPackageName = fragmentPackageNameFactory.create(
binding.getGetterMethodPackage());
String body = String.format("return %s.%s().%s();",
ginjectorNameGenerator.getFieldName(bindings),
nameGenerator.getFragmentGetterMethodName(fragmentPackageName),
nameGenerator.getGetterMethodName(guiceUtil.getKey(method)));