private void ensureAccessible ( Key < ? > key , GinjectorBindings parent , GinjectorBindings child ) { // Parent will be null if it is was an optional dependency and it couldn't be created. if ( parent != null && ! child . equals ( parent ) && ! child . isBound ( key ) ) { PrettyPrinter . log ( logger , TreeLogger . DEBUG , "In %s: inheriting binding for %s from the parent %s" , child , key , parent ) ; Context context = Context . format ( "Inheriting %s from parent" , key ) ; // We don't strictly need all the extra checks in addBinding, but it can't hurt. We know, for // example, that there will not be any unresolved bindings for this key. child . addBinding ( key , bindingFactory . getParentBinding ( key , parent , context ) ) ; } }
Ensure that the binding for key which exists in the parent Ginjector is also available to the child Ginjector .