private GinjectorBindings computeInitialPosition ( Key < ? > key ) { GinjectorBindings initialPosition = output . getGraph ( ) . getOrigin ( ) ; boolean pinned = initialPosition . isPinned ( key ) ; // If the key is pinned (explicitly bound) at the origin, we may be in a situation where we need // to install a binding at the origin, even though we should *use* the binding form a higher // location. // If key is already bound in parent, there is a reason that {@link DependencyExplorer} // chose not to use that binding. Specifically, it implies that the key is exposed to the // parent from the origin. While we are fine using the higher binding, it is still necessary // to install the binding in the origin. if ( pinned ) { PrettyPrinter . log ( logger , TreeLogger . DEBUG , PrettyPrinter . format ( "Forcing %s to be installed in %s due to a pin." , key , initialPosition ) ) ; installOverrides . put ( key , initialPosition ) ; } while ( canExposeKeyFrom ( key , initialPosition , pinned ) ) { PrettyPrinter . log ( logger , TreeLogger . SPAM , "Moving the highest visible position of %s from %s to %s." , key , initialPosition , initialPosition . getParent ( ) ) ; initialPosition = initialPosition . getParent ( ) ; } return initialPosition ; }
Returns the highest injector that we could possibly position the key at without causing a double binding .