xiaodududu / google-guice

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

Private Modules don't de-dup Modules / Bindings from parent modules #661

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When you have a parent module P that installs a module M that binds X and a 
child AbstractModule A that install the same module M, it's fine if the 
bindings in M are explicit or if M defines equals / hashcode. However, if the 
child is instead a PrivateModule P, it doesn't de-dup, and you get a "binding 
to X already configured..." error on injector creation.

See attached source for examples.

Original issue reported on code.google.com by dyr...@gmail.com on 11 Oct 2011 at 11:11

Attachments:

GoogleCodeExporter commented 9 years ago
This is by design.  I sent a message earlier internally, but think I had the 
main idea wrong in the reply (I thought modules were deduplicating & bindings 
weren't).  Everything here is working correctly: neither modules nor bindings 
deduplicate if they are shared between parent & child/private modules, because 
otherwise it would be undefined if the bindings should be private or public.

Original comment by sberlin on 16 Oct 2011 at 3:47