fmgasparino / google-gin

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

bind().in() + bind().to() gives incorrect "double bound" error #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This should work in a GinModule:

    // It is legal to have the bind().in() separate from the bind().to()
    bind(MyProvided.class).in(Singleton.class);
    bind(MyProvided.class).toProvider(MyProvidedProvider.class);

But it does not:
      [ERROR] Double-bound:
Key[type=com.google.gwt.inject.client.MyProvided, annotation=[none]].
com.google.gwt.inject.rebind.binding.CallGwtDotCreateBinding@788896,
com.google.gwt.inject.rebind.binding.BindProviderBinding@714e09

Jesse says that we need to replace the original untargetted binding with
the right one when we see it later. I think the right fix will be for Gin
to stop detecting double bindings altogether because Guice's TOOL-mode
check will catch them (with a better error message anyhow).

Original issue reported on code.google.com by bstoler+code@google.com on 13 Jan 2009 at 6:01

GoogleCodeExporter commented 9 years ago
Actually, in Guice it's forbidden to include the same type in multiple bind 
statements. Create a Guice injector to 
verify this.

Original comment by limpbizkit on 13 Jan 2009 at 9:13

GoogleCodeExporter commented 9 years ago
Doh, I misunderstood.

Original comment by bstoler+code@google.com on 13 Jan 2009 at 5:41