make the earlier dumb hack suck less... cpu cycles at runtime.
git-svn-id: https://google-guice.googlecode.com/svn/trunk@272 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/src/com/google/inject/InternalFactoryToProviderAdapter.java b/src/com/google/inject/InternalFactoryToProviderAdapter.java
index 3404e6e..df40e67 100644
--- a/src/com/google/inject/InternalFactoryToProviderAdapter.java
+++ b/src/com/google/inject/InternalFactoryToProviderAdapter.java
@@ -39,13 +39,7 @@
public T get(InternalContext context) {
T provided = provider.get();
- if (provided != null) {
- return provided;
- }
-
- // TODO(kevinb): gee, ya think we might want to remove this?
- if (("I'm a bad hack".equals(
- System.getProperty("guice.allow.nulls.bad.bad.bad")))) {
+ if (provided != null || allowNullsBadBadBad) {
return provided;
}
String message = String.format(ErrorMessages.NULL_PROVIDED, source);
@@ -56,4 +50,9 @@
public String toString() {
return provider.toString();
}
+
+ // TODO(kevinb): gee, ya think we might want to remove this?
+ private static final boolean allowNullsBadBadBad =
+ "I'm a bad hack".equals(
+ System.getProperty("guice.allow.nulls.bad.bad.bad"));
}
diff --git a/src/com/google/inject/util/Objects.java b/src/com/google/inject/util/Objects.java
index 12f3a84..5f3b660 100644
--- a/src/com/google/inject/util/Objects.java
+++ b/src/com/google/inject/util/Objects.java
@@ -59,9 +59,7 @@
* should be used with Java asserts...
*/
public static void assertNoNulls(Object[] objects) {
- // TODO(kevinb): gee, ya think we might want to remove this?
- if (("I'm a bad hack".equals(
- System.getProperty("guice.allow.nulls.bad.bad.bad")))) {
+ if (allowNullsBadBadBad) {
return;
}
if (objects != null) { // hmm. weird.
@@ -72,4 +70,9 @@
}
}
}
+
+ // TODO(kevinb): gee, ya think we might want to remove this?
+ private static final boolean allowNullsBadBadBad =
+ "I'm a bad hack".equals(
+ System.getProperty("guice.allow.nulls.bad.bad.bad"));
}