Author: limpbizkit
Date: Thu Jul 16 20:10:13 2009
New Revision: 1047

Modified:
    trunk/src/com/google/inject/internal/InjectorImpl.java
    trunk/test/com/google/inject/BindingTest.java

Log:
Fix for bug 403, wherein explicit bindings were kept in the JIT bindings  
map.

Modified: trunk/src/com/google/inject/internal/InjectorImpl.java
==============================================================================
--- trunk/src/com/google/inject/internal/InjectorImpl.java      (original)
+++ trunk/src/com/google/inject/internal/InjectorImpl.java      Thu Jul 16  
20:10:13 2009
@@ -355,6 +355,12 @@
    }

    <T> void initializeBinding(BindingImpl<T> binding, Errors errors) throws  
ErrorsException {
+    if (binding instanceof ConstructorBindingImpl<?>) {
+      ((ConstructorBindingImpl) binding).initialize(this, errors);
+    }
+  }
+
+  <T> void initializeJitBinding(BindingImpl<T> binding, Errors errors)  
throws ErrorsException {
      // Put the partially constructed binding in the map a little early.  
This enables us to handle
      // circular dependencies. Example: FooImpl -> BarImpl -> FooImpl.
      // Note: We don't need to synchronize on state.lock() during injector  
creation.
@@ -616,7 +622,7 @@
      Object source = key.getTypeLiteral().getRawType();
      BindingImpl<T> binding = createUninitializedBinding(key,  
Scoping.UNSCOPED, source, errors);
      errors.throwIfNewErrors(numErrorsBefore);
-    initializeBinding(binding, errors);
+    initializeJitBinding(binding, errors);
      return binding;
    }


Modified: trunk/test/com/google/inject/BindingTest.java
==============================================================================
--- trunk/test/com/google/inject/BindingTest.java       (original)
+++ trunk/test/com/google/inject/BindingTest.java       Thu Jul 16 20:10:13 2009
@@ -396,6 +396,15 @@
      assertEquals(injector,  
bindings.get(Key.get(Injector.class)).getProvider().get());
    }

+  public void testGetAllServletBindings() throws Exception {
+    Injector injector = Guice.createInjector(new AbstractModule() {
+      protected void configure() {
+        bind(F.class); // an explicit binding that uses a JIT binding for  
a constructor
+      }
+    });
+    injector.getAllBindings();
+  }
+
    public static class C<T> {
      private Stage stage;
      private T t;

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to