Status: New
Owner: ----

New issue 789 by [email protected]: PrivateModule bindings conflict only if one of them is exposed
http://code.google.com/p/google-guice/issues/detail?id=789

Description of the issue:

Take a look at the following code. As it is it throws an error saying A binding to java.lang.String annotated with @com.google.inject.name.Named(value=string) was already configured at TestPrivateModules$PM1.configure(TestPrivateModules.jav
a:17)

If I don't expose the binding everything works fine. I'd expect it to work with only one instance of the binding exposed.

import com.google.inject.Guice;
import com.google.inject.Key;
import com.google.inject.PrivateModule;
import com.google.inject.name.Names;

public class TestPrivateModules {
  public static class PM1 extends PrivateModule {
    @Override
    public void configure() {
      bindConstant().annotatedWith(Names.named("string")).to("foo");
      // If I comment out this expose() everything runs fine
      expose(Key.get(String.class, Names.named("string")));
    }
  }

  public static class PM2 extends PrivateModule {
    @Override
    public void configure() {
      bindConstant().annotatedWith(Names.named("string")).to("bar");
    }
  }

  public static void main(String[] args) {
    Guice.createInjector(new PM1(), new PM2());
    System.out.println("ok");
  }
}


--
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