xiaodududu / google-guice

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

Error-checking for requireBinding() declarations #225

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
requireBinding() is a nice way to declare the bindings you need, but it
would be useful for maintenance to have help keeping this list up-to-date.
 How about something like this?

public class DeLoreanModule extends Module {
 public void configure() {
  allExternalBindingsDeclared();
  requireBinding(FluxCapacitor.class);
  requireBinding(TimeCircuits.class);

  // bindings
  bind(Car.class)
    .toProvider(DmcCarProvider.class);
 }
}

If allExternalBindingsDeclared() is on, then Guice should report two
new kinds of errors:

 - any bindings that this module needs, are provided by another
module, and haven't been declared using requireBinding
 - any bindings declared with requireBinding() that will never be
used by this module.

(By the way, this is suspiciously like keeping imports up to date in
.java files and updating dependencies in Makefiles.)

(Similar discussion was in issue 151.)

Original issue reported on code.google.com by bslesinsky on 25 Jul 2008 at 10:16

GoogleCodeExporter commented 9 years ago

Original comment by bslesinsky on 25 Jul 2008 at 10:17

GoogleCodeExporter commented 9 years ago

Original comment by limpbizkit on 31 Dec 2008 at 1:15

GoogleCodeExporter commented 9 years ago

Original comment by cgruber@google.com on 18 Nov 2013 at 8:11

GoogleCodeExporter commented 9 years ago

Original comment by cgruber@google.com on 18 Nov 2013 at 9:13