Status: Accepted
Owner: sberlin

New issue 614 by sberlin: @ImplementedBy creates & needs JIT bindings immediately
http://code.google.com/p/google-guice/issues/detail?id=614

Problem One
----------

  1) Module binds Foo.
  2) Foo is @ImplementedBy(FooImpl.class)
  3) FooImpl class has a dependency on Bar
  4) Bar is @ImplementedBy(AutoBar.class)
  5) Module binds Bar to ExplicitBar.class
When figuring out the @ImplementedBy for FooImpl, it's creating a JIT binding for AutoBar too, and the getExistingBinding check when doing ExplicitBar sees AutoBar and fails.

InjectorImpl.createUninitializedBinding is called by BindingProcessor.visit(UntargettedBinding). It ends up checking for @ImplementedBy (and @ProvidedBy) and creates JIT bindings for them. The JIT bindings then lead to problem two...

Problem Two
-----------

If an untargetted binding is @ImplementedBy, its dependencies need to be eagerly creatable. That is, if
 1) Foo is @ImplementedBy(FooImpl.class)
 2) FooImpl has a dependency on Bar
 3) Bar is explicitly bound in a module AFTER bind(Foo.class) is written
then FAIL, because Bar can't be created when constructing the JIT binding for FooImpl.

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to