aspakh / google-gin

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

Allow double bound for identical definition #191

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Have a gin module (CommonGinModule.java) with a common definition
   bind(A.class).to(AImpl.class);

2. Install the module in Feature-Module-1 and in Feature-Module-2
Feature-Module-1.java:
  bind(Module1Stuff.class);
  install(new CommonGinModule.java);
Feature-Module-2.java:
  bind(Module2Stuff.class);
  install(new CommonGinModule.java);

3. Install the both features in one Application-Gin-Module and you get a 
Double-bound error.

What is the expected output? What do you see instead?
-Ignore double bounds with same definition.

What version of the product are you using? On what operating system?
version 2.1.0

Original issue reported on code.google.com by ronny.bu...@gmail.com on 22 Aug 2013 at 3:20

GoogleCodeExporter commented 8 years ago
I think this is the expected behavior. However, if your CommonGinModule 
implements equals() in a way that the two instances compare equal, then it'll 
only be installed once. See issue 130.

Original comment by t.broyer on 22 Aug 2013 at 3:55

GoogleCodeExporter commented 8 years ago
As Thomas mentions, you can already solve this with equals() on the module 
which mirrors Guice behaviour.

Original comment by aragos on 22 Aug 2013 at 4:35