rm ServletScopes.nullObject -- use a null value in the map to seed a key with null.
git-svn-id: https://google-guice.googlecode.com/svn/trunk@1429 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/extensions/servlet/src/com/google/inject/servlet/ServletScopes.java b/extensions/servlet/src/com/google/inject/servlet/ServletScopes.java
index 6b19097..c1f2f7b 100644
--- a/extensions/servlet/src/com/google/inject/servlet/ServletScopes.java
+++ b/extensions/servlet/src/com/google/inject/servlet/ServletScopes.java
@@ -157,8 +157,8 @@
* @param callable code to be executed in another thread, which depends on
* the request scope.
* @param seedMap the initial set of scoped instances for Guice to seed the
- * request scope with. To seed with null, use either a null
- * value or a value of {@link #nullObject()}.
+ * request scope with. To seed a key with null, use {@code null} as
+ * the value.
* @return a callable that will invoke the given callable, making the request
* context available to it.
* @throws OutOfScopeException if this method is called from a non-request
@@ -220,8 +220,8 @@
* @param callable code to be executed which depends on the request scope.
* Typically in another thread, but not necessarily so.
* @param seedMap the initial set of scoped instances for Guice to seed the
- * request scope with. To seed with null, use either a null
- * value or a value of {@link #nullObject()}.
+ * request scope with. To seed a key with null, use {@code null} as
+ * the value.
* @return a callable that when called will run inside the a request scope
* that exposes the instances in the {@code seedMap} as scoped keys.
* @since 3.0
@@ -257,17 +257,6 @@
}
/**
- * Returns an object that may be used in the seedMap of
- * {@link #continueRequest} and {@link #scopeRequest} to indicate the value
- * should remain null and not attempt to be created.
- *
- * @since 3.0
- */
- public static Object nullObject() {
- return NullObject.INSTANCE;
- }
-
- /**
* Validates the key and object, ensuring the value matches the key type, and
* canonicalizing null objects to the null sentinel.
*/
diff --git a/extensions/servlet/test/com/google/inject/servlet/ScopeRequestIntegrationTest.java b/extensions/servlet/test/com/google/inject/servlet/ScopeRequestIntegrationTest.java
index 53128ee..75be749 100644
--- a/extensions/servlet/test/com/google/inject/servlet/ScopeRequestIntegrationTest.java
+++ b/extensions/servlet/test/com/google/inject/servlet/ScopeRequestIntegrationTest.java
@@ -120,16 +120,11 @@
assertTrue(pe.getCause() instanceof OutOfScopeException);
}
- // First validate that an actual null entry gets replaced with the null sentinel.
+ // Validate that an actual null entry in the map results in a null injected object.
Map<Key<?>, Object> map = Maps.newHashMap();
map.put(Key.get(SomeObject.class), null);
callable = ServletScopes.scopeRequest(injector.getInstance(Caller.class), map);
assertNull(callable.call());
-
- // Then validate that our nullObject entry also gets replaced.
- callable = ServletScopes.scopeRequest(injector.getInstance(Caller.class),
- ImmutableMap.<Key<?>, Object>of(Key.get(SomeObject.class), ServletScopes.nullObject()));
- assertNull(callable.call());
}
@RequestScoped