pombreda / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 1 forks source link

Checked provider and requireExplicitBindings interaction #747

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently using checked providers extension together with 
requireExplicitBindings() call on the binder require presence of explicit 
binding for the checked provider:

binder().requireExplicitBindings();

ThrowingProviderBinder.create(binder())
    .bind(CustomCheckedProvider.class, CustomObject.class)
    .to(DefaultCustomCheckedProvider.class);

bind(DefaultCustomCheckedProvider.class);  // Without this Injector 
configuration fails

However, there is no such problem with regular providers, and I can use them 
without explicit bindings:

binder().requireExplicitBindings();

bind(CustomObject.class).toProvider(RegularCustomObjectProvider.class);
// no explicit binding of RegularCustomObjectProvider is required

I think that explicit binding of checked provider is redundant and should not 
be required; after all, we specify that we want to use it in 
ThrowingProviderBinder call.

Original issue reported on code.google.com by dpx.infinity@gmail.com on 29 Apr 2013 at 10:34