Fixing the binding order problem. My strategy was to break binding creation into two steps:
 - creating the binding itself
 - "initializing" the binding, ie. validating the bindings dependencies

This CL is a start of something that we could go further on. In particular, we could change the @ProvidedBy etc. bindings to use a BindingImpl.initialize() method uniformly to separate creating the binding from building its dependencies.

git-svn-id: https://google-guice.googlecode.com/svn/trunk@473 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/src/com/google/inject/ClassBindingImpl.java b/src/com/google/inject/ClassBindingImpl.java
index 9eb2756..65cdf30 100644
--- a/src/com/google/inject/ClassBindingImpl.java
+++ b/src/com/google/inject/ClassBindingImpl.java
@@ -17,6 +17,7 @@
 package com.google.inject;
 
 import com.google.inject.InjectorImpl.SingleParameterInjector;
+import com.google.inject.internal.ResolveFailedException;
 import com.google.inject.internal.ToStringBuilder;
 import com.google.inject.spi.BindingVisitor;
 import com.google.inject.spi.ClassBinding;
@@ -40,6 +41,10 @@
     this.lateBoundConstructor = lateBoundConstructor;
   }
 
+  @Override void initialize(InjectorImpl injector) throws ResolveFailedException {
+    lateBoundConstructor.bind(injector, getBoundClass());
+  }
+
   public void accept(BindingVisitor<? super T> visitor) {
     visitor.visit(this);
   }