Status: New
Owner: ----

New issue 774 by [email protected]: Modules.override() loses source information when the current source is skipped
http://code.google.com/p/google-guice/issues/detail?id=774

This test case:

<code language="java">
Guice.createInjector(new AbstractModule() {
    @Override
    protected void configure() {
        bind(String.class).toInstance("foo");
install(Modules.override(Modules.EMPTY_MODULE).with(new AbstractModule() {
            @Override
            protected void configure() {
binder().skipSources(getClass()).bind(String.class).toInstance("bar");
            }
        }));
    }
});
</code>

Produces this error:

{{{
1) A binding to java.lang.String was already configured at Test$1.configure(Test.java:74). at com.google.inject.util.Modules$RealOverriddenModuleBuilder$1.configure(Modules.java:172)
}}}

If the module is installed directly, without Modules.override(), it gives

{{{
1) A binding to java.lang.String was already configured at Test$1.configure(Test.java:74).
  at Test$1.configure(Test.java:75)
}}}

instead, which is a lot more helpful.

This seems like a general issue with `Elements.getElements()`: there's no way to specify sources to skip, so the bindings it creates can't have sources from above the `Elements.getElements()` call.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to