Pulled up some anonymous inner classes. Hopefully the CB will be eligible for garbage collection after startup. I'll have to test this theory later.

git-svn-id: https://google-guice.googlecode.com/svn/trunk@45 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/guice.iws b/guice.iws
index 212c44b..9d14620 100644
--- a/guice.iws
+++ b/guice.iws
@@ -18,18 +18,22 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" name="Default" comment="">
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/google/inject/InternalFactoryToContextualFactoryAdapter.java" afterPath="$PROJECT_DIR$/src/com/google/inject/InternalFactoryToContextualFactoryAdapter.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/com/google/inject/NotRequiredTest.java" afterPath="$PROJECT_DIR$/test/com/google/inject/NotRequiredTest.java" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/google/inject/Stopwatch.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/com/google/inject/SuperclassTest.java" afterPath="$PROJECT_DIR$/test/com/google/inject/SuperclassTest.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/google/inject/Stopwatch.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/com/google/inject/ErrorHandlingTest.java" afterPath="$PROJECT_DIR$/test/com/google/inject/ErrorHandlingTest.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/com/google/inject/GenericInjectionTest.java" afterPath="$PROJECT_DIR$/test/com/google/inject/GenericInjectionTest.java" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/guice.ipr" afterPath="$PROJECT_DIR$/guice.ipr" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/google/inject/ContainerCreationException.java" afterPath="$PROJECT_DIR$/src/com/google/inject/ContainerCreationException.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/google/inject/FactoryToInternalFactoryAdapter.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/com/google/inject/ConstantConversionTest.java" afterPath="$PROJECT_DIR$/test/com/google/inject/ConstantConversionTest.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/guice.ipr" afterPath="$PROJECT_DIR$/guice.ipr" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/com/google/inject/FactoryInjectionTest.java" afterPath="$PROJECT_DIR$/test/com/google/inject/FactoryInjectionTest.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/guice.iws" afterPath="$PROJECT_DIR$/guice.iws" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/com/google/inject/StaticInjectionTest.java" afterPath="$PROJECT_DIR$/test/com/google/inject/StaticInjectionTest.java" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/google/inject/ContainerCreationException.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/google/inject/ContainerBuilder.java" afterPath="$PROJECT_DIR$/src/com/google/inject/ContainerBuilder.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/google/inject/InternalFactoryToFactoryAdapter.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/google/inject/InternalToContextualFactoryAdapter.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/com/google/inject/ContainerTest.java" afterPath="$PROJECT_DIR$/test/com/google/inject/ContainerTest.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/com/google/inject/PerformanceComparison.java" afterPath="$PROJECT_DIR$/test/com/google/inject/PerformanceComparison.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/com/google/inject/CircularDependencyTest.java" afterPath="$PROJECT_DIR$/test/com/google/inject/CircularDependencyTest.java" />
@@ -202,271 +206,37 @@
   </component>
   <component name="FileEditorManager">
     <leaf>
-      <file leaf-file-name="ContainerBuilder.java" pinned="false" current="false" current-in-tab="false">
+      <file leaf-file-name="ContainerBuilder.java" pinned="false" current="true" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/src/com/google/inject/ContainerBuilder.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state line="304" column="41" selection-start="9355" selection-end="9355" vertical-scroll-proportion="0.5181102">
+            <state line="95" column="77" selection-start="3261" selection-end="3261" vertical-scroll-proportion="0.24697986">
               <folding />
             </state>
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="Stopwatch.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/Stopwatch.java">
+      <file leaf-file-name="InternalToContextualFactoryAdapter.java" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/com/google/inject/InternalToContextualFactoryAdapter.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state line="27" column="0" selection-start="461" selection-end="461" vertical-scroll-proportion="0.72283465">
+            <state line="21" column="18" selection-start="512" selection-end="512" vertical-scroll-proportion="0.47919464">
               <folding />
             </state>
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="FactoryInjectionTest.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/test/com/google/inject/FactoryInjectionTest.java">
+      <file leaf-file-name="InternalFactoryToFactoryAdapter.java" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/com/google/inject/InternalFactoryToFactoryAdapter.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state line="17" column="29" selection-start="467" selection-end="467" vertical-scroll-proportion="0.45511812">
+            <state line="15" column="34" selection-start="391" selection-end="391" vertical-scroll-proportion="0.34228188">
               <folding />
             </state>
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="CircularDependencyTest.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/test/com/google/inject/CircularDependencyTest.java">
+      <file leaf-file-name="FactoryToInternalFactoryAdapter.java" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/com/google/inject/FactoryToInternalFactoryAdapter.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state line="33" column="32" selection-start="1075" selection-end="1075" vertical-scroll-proportion="0.45511812">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="ErrorMessage.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/ErrorMessage.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="105" column="19" selection-start="3587" selection-end="3587" vertical-scroll-proportion="0.97952753">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="StackTraceElement.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="jar:///usr/local/src.zip!/java/lang/StackTraceElement.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="21" column="19" selection-start="714" selection-end="714" vertical-scroll-proportion="0.28503937">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="AllTests.java" pinned="false" current="true" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/test/com/google/inject/AllTests.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="29" column="13" selection-start="964" selection-end="964" vertical-scroll-proportion="0.24094488">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="AbstractErrorHandler.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/AbstractErrorHandler.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="60" column="22" selection-start="1794" selection-end="1794" vertical-scroll-proportion="0.85984254">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="Key.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/Key.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="23" column="25" selection-start="741" selection-end="741" vertical-scroll-proportion="0.026771653">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="ContainerCreationException.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/ContainerCreationException.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="12" column="9" selection-start="309" selection-end="309" vertical-scroll-proportion="0.32125986">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="ContainerImpl.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/ContainerImpl.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="126" column="15" selection-start="4059" selection-end="4059" vertical-scroll-proportion="0.026771653">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="ConstructionContext.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/ConstructionContext.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="68" column="16" selection-start="1863" selection-end="1863" vertical-scroll-proportion="0.02992126">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="ReferenceCache.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/util/ReferenceCache.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="52" column="0" selection-start="1648" selection-end="1648" vertical-scroll-proportion="1.0173228">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="ErrorHandler.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/ErrorHandler.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="9" column="10" selection-start="178" selection-end="178" vertical-scroll-proportion="0.24094488">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="ErrorHandlingTest.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/test/com/google/inject/ErrorHandlingTest.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="45" column="28" selection-start="1002" selection-end="1002" vertical-scroll-proportion="1.2047244">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="StaticInjectionTest.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/test/com/google/inject/StaticInjectionTest.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="31" column="24" selection-start="1044" selection-end="1044" vertical-scroll-proportion="0.45511812">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="GenericInjectionTest.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/test/com/google/inject/GenericInjectionTest.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="18" column="32" selection-start="551" selection-end="551" vertical-scroll-proportion="0.4015748">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="SuperclassTest.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/test/com/google/inject/SuperclassTest.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="28" column="36" selection-start="952" selection-end="952" vertical-scroll-proportion="0.37480316">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="PerformanceComparison.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/test/com/google/inject/PerformanceComparison.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="95" column="8" selection-start="3528" selection-end="3558" vertical-scroll-proportion="0.4976378">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="NotRequiredTest.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/test/com/google/inject/NotRequiredTest.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="32" column="3" selection-start="1058" selection-end="1058" vertical-scroll-proportion="0.48188975">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="ContainerTest.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/test/com/google/inject/ContainerTest.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="189" column="4" selection-start="4176" selection-end="4176" vertical-scroll-proportion="1.0598425">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="ConstantConversionTest.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/test/com/google/inject/ConstantConversionTest.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="110" column="17" selection-start="3274" selection-end="3274" vertical-scroll-proportion="2.4897637">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="AbstractModule.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/AbstractModule.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="121" column="0" selection-start="2941" selection-end="2941" vertical-scroll-proportion="1.5291339">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="TypeLiteral.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/TypeLiteral.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="40" column="4" selection-start="1254" selection-end="1254" vertical-scroll-proportion="0.026771653">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="ConfigurationException.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/ConfigurationException.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="33" column="2" selection-start="958" selection-end="958" vertical-scroll-proportion="0.5086614">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="Type.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="jar:///usr/local/src.zip!/java/lang/reflect/Type.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="17" column="17" selection-start="426" selection-end="426" vertical-scroll-proportion="0.32125986">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="Container.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/Container.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="62" column="2" selection-start="1876" selection-end="1876" vertical-scroll-proportion="0.7259843">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="Scopes.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/com/google/inject/Scopes.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="20" column="1" selection-start="432" selection-end="432" vertical-scroll-proportion="0.53543305">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="Formatter.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="jar:///usr/local/src.zip!/java/util/Formatter.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="2428" column="0" selection-start="100784" selection-end="100784" vertical-scroll-proportion="0.026771653">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="String.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="jar:///usr/local/src.zip!/java/lang/String.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="2519" column="0" selection-start="99424" selection-end="99424" vertical-scroll-proportion="0.027419355">
+            <state line="14" column="32" selection-start="397" selection-end="397" vertical-scroll-proportion="0.31946307">
               <folding />
             </state>
           </provider>
@@ -689,23 +459,16 @@
     </key>
   </component>
   <component name="RestoreUpdateTree" />
-  <component name="RunManager" selected="JUnit.AllTests">
-    <tempConfiguration default="false" name="AllTests" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
-      <pattern value="com.google.inject.*" />
-      <module name="guice" />
+  <component name="RunManager" selected="Application.ErrorHandlingTest">
+    <tempConfiguration default="false" name="ErrorHandlingTest" type="Application" factoryName="Application" enabled="false" merge="false">
+      <option name="MAIN_CLASS_NAME" value="com.google.inject.ErrorHandlingTest" />
+      <option name="VM_PARAMETERS" />
+      <option name="PROGRAM_PARAMETERS" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
       <option name="ALTERNATIVE_JRE_PATH" />
-      <option name="PACKAGE_NAME" value="com.google.inject" />
-      <option name="MAIN_CLASS_NAME" value="com.google.inject.AllTests" />
-      <option name="METHOD_NAME" />
-      <option name="TEST_OBJECT" value="class" />
-      <option name="VM_PARAMETERS" />
-      <option name="PARAMETERS" />
-      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
-      <option name="ADDITIONAL_CLASS_PATH" />
-      <option name="TEST_SEARCH_SCOPE">
-        <value defaultName="wholeProject" />
-      </option>
+      <option name="ENABLE_SWING_INSPECTOR" value="false" />
+      <module name="guice" />
       <RunnerSettings RunnerId="Run" />
       <ConfigurationWrapper RunnerId="Run" />
       <method>
@@ -863,7 +626,7 @@
   </component>
   <component name="ToolWindowManager">
     <frame x="4" y="44" width="1916" height="1156" extended-state="0" />
-    <editor active="false" />
+    <editor active="true" />
     <layout>
       <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
       <window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
@@ -873,7 +636,7 @@
       <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.15854311" order="0" />
       <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.29517502" order="1" />
       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.16236559" order="1" />
-      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.27909178" order="10" />
+      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.27909178" order="10" />
       <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="6" />
       <window_info id="Profile" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32890996" order="13" />
       <window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
@@ -881,7 +644,7 @@
       <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
       <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.14623655" order="1" />
       <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3282876" order="8" />
-      <window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.38315988" order="2" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.38315988" order="2" />
       <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="2" />
       <window_info id="File View" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="6" />
       <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39978448" order="0" />
@@ -980,76 +743,6 @@
     <option name="myLastEditedConfigurable" value="Default" />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/src/com/google/inject/ContainerCreationException.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="12" column="9" selection-start="309" selection-end="309" vertical-scroll-proportion="0.32125986">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/google/inject/Stopwatch.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="27" column="0" selection-start="461" selection-end="461" vertical-scroll-proportion="0.72283465">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/test/com/google/inject/FactoryInjectionTest.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="17" column="29" selection-start="467" selection-end="467" vertical-scroll-proportion="0.45511812">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/test/com/google/inject/CircularDependencyTest.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="33" column="32" selection-start="1075" selection-end="1075" vertical-scroll-proportion="0.45511812">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/google/inject/ErrorHandler.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="9" column="10" selection-start="178" selection-end="178" vertical-scroll-proportion="0.24094488">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/test/com/google/inject/ErrorHandlingTest.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="45" column="28" selection-start="1002" selection-end="1002" vertical-scroll-proportion="1.2047244">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/test/com/google/inject/StaticInjectionTest.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="31" column="24" selection-start="1044" selection-end="1044" vertical-scroll-proportion="0.45511812">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/test/com/google/inject/GenericInjectionTest.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="18" column="32" selection-start="551" selection-end="551" vertical-scroll-proportion="0.4015748">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/test/com/google/inject/SuperclassTest.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="28" column="36" selection-start="952" selection-end="952" vertical-scroll-proportion="0.37480316">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/test/com/google/inject/PerformanceComparison.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="95" column="8" selection-start="3528" selection-end="3558" vertical-scroll-proportion="0.4976378">
-          <folding />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/test/com/google/inject/NotRequiredTest.java">
       <provider selected="true" editor-type-id="text-editor">
         <state line="32" column="3" selection-start="1058" selection-end="1058" vertical-scroll-proportion="0.48188975">
@@ -1071,16 +764,86 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/google/inject/ContainerBuilder.java">
+    <entry file="file://$PROJECT_DIR$/src/com/google/inject/AbstractModule.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="304" column="41" selection-start="9355" selection-end="9355" vertical-scroll-proportion="0.5181102">
+        <state line="121" column="0" selection-start="2941" selection-end="2941" vertical-scroll-proportion="1.5291339">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/test/com/google/inject/AllTests.java">
+    <entry file="file://$PROJECT_DIR$/src/com/google/inject/TypeLiteral.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="29" column="13" selection-start="964" selection-end="964" vertical-scroll-proportion="0.24094488">
+        <state line="40" column="4" selection-start="1254" selection-end="1254" vertical-scroll-proportion="0.026771653">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/google/inject/ConfigurationException.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="33" column="2" selection-start="958" selection-end="958" vertical-scroll-proportion="0.5086614">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar:///usr/local/src.zip!/java/lang/reflect/Type.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="17" column="17" selection-start="426" selection-end="426" vertical-scroll-proportion="0.32125986">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/google/inject/Container.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="62" column="2" selection-start="1876" selection-end="1876" vertical-scroll-proportion="0.7259843">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/google/inject/Scopes.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="20" column="1" selection-start="432" selection-end="432" vertical-scroll-proportion="0.53543305">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar:///usr/local/src.zip!/java/util/Formatter.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="2428" column="0" selection-start="100784" selection-end="100784" vertical-scroll-proportion="0.026771653">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar:///usr/local/src.zip!/java/lang/String.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="2519" column="0" selection-start="99424" selection-end="99424" vertical-scroll-proportion="0.026771653">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/google/inject/FactoryToInternalFactoryAdapter.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="14" column="32" selection-start="397" selection-end="397" vertical-scroll-proportion="0.31946307">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/google/inject/InternalFactoryToFactoryAdapter.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="15" column="34" selection-start="391" selection-end="391" vertical-scroll-proportion="0.34228188">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/google/inject/InternalToContextualFactoryAdapter.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="21" column="18" selection-start="512" selection-end="512" vertical-scroll-proportion="0.47919464">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/google/inject/ContainerBuilder.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="95" column="77" selection-start="3261" selection-end="3261" vertical-scroll-proportion="0.24697986">
           <folding />
         </state>
       </provider>
diff --git a/src/com/google/inject/ContainerBuilder.java b/src/com/google/inject/ContainerBuilder.java
index a6f7cd1..b5bb567 100644
--- a/src/com/google/inject/ContainerBuilder.java
+++ b/src/com/google/inject/ContainerBuilder.java
@@ -93,8 +93,8 @@
 
   static final Scope DEFAULT_SCOPE = new Scope() {
     public <T> Factory<T> scope(Key<T> key, Factory<T> creator) {
-      // We actually optimize around this.
-      throw new UnsupportedOperationException();
+      // We special case optimize default scope, so this never actually runs.
+      throw new AssertionError();
     }
   };
 
@@ -405,7 +405,8 @@
     }
   }
 
-  private void createConstantBindings(HashMap<Key<?>, InternalFactory<?>> factories) {
+  private void createConstantBindings(
+      HashMap<Key<?>, InternalFactory<?>> factories) {
     for (ConstantBindingBuilder builder : constantBindingBuilders) {
       if (builder.hasValue()) {
         Key<?> key = builder.getKey();
@@ -498,7 +499,7 @@
     public <I extends T> BindingBuilder<T> to(TypeLiteral<I> implementation) {
       ensureImplementationIsNotSet();
       validate(source, implementation.getRawType());
-      this.factory = new DefaultFactory<I>(implementation);
+      this.factory = new DefaultFactory<I>(key, implementation);
       setScopeFromType(implementation.getRawType());
       return this;
     }
@@ -517,15 +518,7 @@
         final ContextualFactory<? extends T> factory) {
       ensureImplementationIsNotSet();
 
-      this.factory = new InternalFactory<T>() {
-        public T get(InternalContext context) {
-          return factory.get(context.getExternalContext());
-        }
-
-        public String toString() {
-          return factory.toString();
-        }
-      };
+      this.factory = new InternalToContextualFactoryAdapter<T>(factory);
 
       return this;
     }
@@ -535,17 +528,7 @@
      */
     public BindingBuilder<T> to(final Factory<? extends T> factory) {
       ensureImplementationIsNotSet();
-
-      this.factory = new InternalFactory<T>() {
-        public T get(InternalContext context) {
-          return factory.get();
-        }
-
-        public String toString() {
-          return factory.toString();
-        }
-      };
-
+      this.factory = new InternalFactoryToFactoryAdapter<T>(factory);
       return this;
     }
 
@@ -620,66 +603,44 @@
         return this.factory;
       }
 
-      // TODO: This is a little hairy.
-      final InternalFactory<? extends T> internalFactory = this.factory;
-      final Factory<T> factory = scope.scope(this.key, new Factory<T>() {
-        public T get() {
-          return container.callInContext(
-              new ContainerImpl.ContextualCallable<T>() {
-            public T call(InternalContext context) {
-              return internalFactory.get(context);
-            }
-          });
-        }
-
-        public String toString() {
-          return internalFactory.toString();
-        }
-      });
-
-      return new InternalFactory<T>() {
-        public T get(InternalContext context) {
-          return factory.get();
-        }
-
-        public String toString() {
-          return factory.toString();
-        }
-      };
+      Factory<T> scoped = scope.scope(this.key,
+          new FactoryToInternalFactoryAdapter<T>(container, this.factory));
+      return new InternalFactoryToFactoryAdapter<T>(scoped);
     }
 
     boolean isInContainerScope() {
       return this.scope == ContainerScope.INSTANCE;
     }
+  }
 
-    /**
-     * Injects new instances of the specified implementation class.
-     */
-    private class DefaultFactory<I extends T> implements InternalFactory<I> {
+  /**
+   * Injects new instances of the specified implementation class.
+   */
+  private static class DefaultFactory<T> implements InternalFactory<T> {
 
-      volatile ContainerImpl.ConstructorInjector<I> constructor;
+    volatile ContainerImpl.ConstructorInjector<T> constructor;
 
-      private final TypeLiteral<I> implementation;
+    private final TypeLiteral<T> implementation;
+    private final Key<? super T> key;
 
-      public DefaultFactory(TypeLiteral<I> implementation) {
-        // TODO: Ensure this is a concrete implementation.
-        this.implementation = implementation;
+    public DefaultFactory(Key<? super T> key, TypeLiteral<T> implementation) {
+      this.key = key;
+      this.implementation = implementation;
+    }
+
+    @SuppressWarnings("unchecked")
+    public T get(InternalContext context) {
+      if (constructor == null) {
+        // This unnecessary cast is a workaround for an annoying compiler
+        // bug I keep running into.
+        Object c = context.getContainerImpl().getConstructor(implementation);
+        this.constructor = (ContainerImpl.ConstructorInjector<T>) c;
       }
+      return (T) constructor.construct(context, key.getRawType());
+    }
 
-      @SuppressWarnings("unchecked")
-      public I get(InternalContext context) {
-        if (constructor == null) {
-          // This unnecessary cast is a workaround for an annoying compiler
-          // bug I keep running into.
-          Object c = context.getContainerImpl().getConstructor(implementation);
-          this.constructor = (ContainerImpl.ConstructorInjector<I>) c;
-        }
-        return (I) constructor.construct(context, key.getRawType());
-      }
-
-      public String toString() {
-        return implementation.toString();
-      }
+    public String toString() {
+      return implementation.toString();
     }
   }
 
diff --git a/src/com/google/inject/ContainerCreationException.java b/src/com/google/inject/ContainerCreationException.java
index fbbdc47..1cbf14f 100644
--- a/src/com/google/inject/ContainerCreationException.java
+++ b/src/com/google/inject/ContainerCreationException.java
@@ -4,7 +4,8 @@
 
 /**
  * Thrown when errors occurs while creating a {@link Container}. Includes a
- * list of encountered errors.
+ * list of encountered errors. Typically, a client should catch this exception,
+ * log it, and stop execution.
  *
  * @author crazybob@google.com (Bob Lee)
  */
diff --git a/src/com/google/inject/FactoryToInternalFactoryAdapter.java b/src/com/google/inject/FactoryToInternalFactoryAdapter.java
new file mode 100644
index 0000000..a7bca2b
--- /dev/null
+++ b/src/com/google/inject/FactoryToInternalFactoryAdapter.java
@@ -0,0 +1,32 @@
+// Copyright 2006 Google Inc. All Rights Reserved.
+
+package com.google.inject;
+
+/**
+ * @author crazybob@google.com (Bob Lee)
+*/
+class FactoryToInternalFactoryAdapter<T> implements Factory<T> {
+
+  private final ContainerImpl container;
+
+  private final InternalFactory<? extends T> internalFactory;
+
+  public FactoryToInternalFactoryAdapter(ContainerImpl container,
+      InternalFactory<? extends T> internalFactory) {
+    this.container = container;
+    this.internalFactory = internalFactory;
+  }
+
+  public T get() {
+    return container.callInContext(
+        new ContainerImpl.ContextualCallable<T>() {
+      public T call(InternalContext context) {
+        return internalFactory.get(context);
+      }
+    });
+  }
+
+  public String toString() {
+    return internalFactory.toString();
+  }
+}
diff --git a/src/com/google/inject/InternalFactoryToFactoryAdapter.java b/src/com/google/inject/InternalFactoryToFactoryAdapter.java
new file mode 100644
index 0000000..318be41
--- /dev/null
+++ b/src/com/google/inject/InternalFactoryToFactoryAdapter.java
@@ -0,0 +1,23 @@
+// Copyright 2006 Google Inc. All Rights Reserved.
+
+package com.google.inject;
+
+/**
+ * @author crazybob@google.com (Bob Lee)
+*/
+class InternalFactoryToFactoryAdapter<T> implements InternalFactory<T> {
+
+  private final Factory<? extends T> factory;
+
+  public InternalFactoryToFactoryAdapter(Factory<? extends T> factory) {
+    this.factory = factory;
+  }
+  
+  public T get(InternalContext context) {
+    return factory.get();
+  }
+
+  public String toString() {
+    return factory.toString();
+  }
+}
diff --git a/src/com/google/inject/InternalToContextualFactoryAdapter.java b/src/com/google/inject/InternalToContextualFactoryAdapter.java
new file mode 100644
index 0000000..9c2bbf5
--- /dev/null
+++ b/src/com/google/inject/InternalToContextualFactoryAdapter.java
@@ -0,0 +1,25 @@
+// Copyright 2006 Google Inc. All Rights Reserved.
+
+package com.google.inject;
+
+/**
+ * @author crazybob@google.com (Bob Lee)
+*/
+class InternalToContextualFactoryAdapter<T> 
+    implements InternalFactory<T> {
+
+  private final ContextualFactory<? extends T> factory;
+
+  public InternalToContextualFactoryAdapter(
+      ContextualFactory<? extends T> factory) {
+    this.factory = factory;
+  }
+
+  public T get(InternalContext context) {
+    return factory.get(context.getExternalContext());
+  }
+
+  public String toString() {
+    return factory.toString();
+  }
+}