frjaeger220 / google-guice

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

Wrong error reporting with double declarations and overrides #306

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have a module A that install modules B and C and I override with module D.
Modules B, C and D have identical declarations and bind the class Clazz to
something.
The error reported with this scenario is that Clazz is declared in both
modules B and D whereas the real bug is that it is declared in modules B and C.

Original issue reported on code.google.com by erik.put...@nrc-cnrc.gc.ca on 6 Jan 2009 at 6:19

GoogleCodeExporter commented 9 years ago
Could you provide a test case? Just something I can add to the test-case:
http://www.google.com/codesearch/p?hl=en#vY65eMZAf-c/test/com/google/inject/Over
rideModuleTest.java

Original comment by limpbizkit on 6 Jan 2009 at 7:08

GoogleCodeExporter commented 9 years ago
Done, attached is a patch to the testcase that reproduces the issue.

Original comment by erik.put...@nrc-cnrc.gc.ca on 6 Jan 2009 at 4:36

Attachments:

GoogleCodeExporter commented 9 years ago
Interesting.

The problem with trying to track down B and C as duplicates is that those 
aren't the bindings that will ultimately 
end up in the Injector. The binding in B gets overridden by D, leading to the 
error we're reporting.

There's not really anything obvious I can do here, although I can see how this 
is problematic. I'll leave this open 
for now...

Original comment by limpbizkit on 8 Jan 2009 at 2:34

GoogleCodeExporter commented 9 years ago
Any way you could check if the bindings are correct before overriding and only 
after
that override the keys?

Original comment by erik%ens...@gtempaccount.com on 8 Jan 2009 at 5:45

GoogleCodeExporter commented 9 years ago
Can you confirm if this is still a problem with the latest Guice SVN code?  If 
the bindings are exactly duplicate, the problem should have gone away.

Original comment by sberlin on 24 Sep 2010 at 1:21

GoogleCodeExporter commented 9 years ago
This should be fixed by duplicate bindings being collapsed into a single 
binding (instead of an error).

Original comment by sberlin on 22 Oct 2010 at 3:43