google-code-export / google-guice

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

getAllBindings() throws exception for servlet module #403

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Using snapshot 20090706

With this test:

  public void testGetAllServletBindings() throws Exception {
    Injector injector = Guice.createInjector(new ServletModule());
    injector.getAllBindings();
  }

I get an exception:

java.lang.IllegalArgumentException: duplicate key:
Key[type=com.google.inject.servlet.ManagedServletPipeline, annotation=[none]]
    at
com.google.inject.internal.ImmutableMap$RegularImmutableMap.<init>(ImmutableMap.
java:591)
    at
com.google.inject.internal.ImmutableMap$RegularImmutableMap.<init>(ImmutableMap.
java:559)
    at
com.google.inject.internal.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:
208)
    at
com.google.inject.internal.ImmutableMap$Builder.build(ImmutableMap.java:194)
    at
com.google.inject.internal.InjectorImpl.getAllBindings(InjectorImpl.java:634)
    at
com.google.projectdb.PdbServerTest.testGetAllServletBindings(PdbServerTest.java:
42)

Original issue reported on code.google.com by bslesinsky on 16 Jul 2009 at 9:26

GoogleCodeExporter commented 9 years ago
Fixed by r1047.

Most notably, the fact that Google Collections' ImmutableMap.Builder blows up 
if it contains two identical entries 
helped me to discover this bug! Yay GCL.

Original comment by limpbizkit on 17 Jul 2009 at 3:11