Added type conversion for constants. Optimized ReferenceCache. 

Removed null check from ContainerImpl.getInstance(). Added Container.hasBindingFor() to provide comparable functionality.

Made Key public.

git-svn-id: https://google-guice.googlecode.com/svn/trunk@5 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/src/com/google/inject/InternalContext.java b/src/com/google/inject/InternalContext.java
index d9d9879..322e065 100644
--- a/src/com/google/inject/InternalContext.java
+++ b/src/com/google/inject/InternalContext.java
@@ -30,11 +30,12 @@
   final ContainerImpl container;
   final Map<Object, ConstructionContext<?>> constructionContexts =
       new HashMap<Object, ConstructionContext<?>>();
-  Scope.Strategy scopeStrategy;
+  final Scope.Strategy scopeStrategy;
   ExternalContext<?> externalContext;
 
-  InternalContext(ContainerImpl container) {
+  InternalContext(ContainerImpl container, Scope.Strategy scopeStrategy) {
     this.container = container;
+    this.scopeStrategy = scopeStrategy;
   }
 
   public Container getContainer() {
@@ -47,12 +48,8 @@
 
   Scope.Strategy getScopeStrategy() {
     if (scopeStrategy == null) {
-      scopeStrategy = container.localScopeStrategy.get();
-
-      if (scopeStrategy == null) {
-        throw new IllegalStateException("Scope strategy not set. "
-            + "Please call Container.setScopeStrategy().");
-      }
+      throw new IllegalStateException("Scope strategy not set. "
+          + "Please call Container.setScopeStrategy().");
     }
 
     return scopeStrategy;