google / google/guice

Checked provider and requireExplicitBindings interaction

Open
#747 0 comments 0 reactions 0 assignees View on GitHub
imported
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

_From [dpx.infinity](https://code.google.com/u/dpx.infinity@gmail.com/) on April 29, 2013 06:34:56_

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: http://code.google.com/p/google-guice/issues/detail?id=747_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.