aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorSam Berlin <sameb@google.com>2014-07-17 18:19:08 -0400
committerSam Berlin <sameb@google.com>2014-07-17 18:22:35 -0400
commit7715581cb3521f0d6ba48f957e8daa492383fba3 (patch)
tree0ff153e58b9fd8b177ffb6f61a45144249d4d87f /core
parent50b3d3d70b3fcb1423650beedb0d175cd1b87a3b (diff)
downloadguice-7715581cb3521f0d6ba48f957e8daa492383fba3.tar.gz
Fix last flaky test (that I know of). The problem was we were asserting that something existed in a child injector (through inference, by checking it was in the parent blacklist), but if GC ran it could have been ejected from the parent blacklist (since the child injector isn't strongly referenced anywhere).
There's an actual problem here that we should fix (remove items from the parent blacklist immediately if the child injector fails to create itself), but before fixing that we can at least make the test not flake. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=71369181
Diffstat (limited to 'core')
-rw-r--r--core/test/com/google/inject/JitBindingsTest.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/test/com/google/inject/JitBindingsTest.java b/core/test/com/google/inject/JitBindingsTest.java
index cd9a964c..10ecb339 100644
--- a/core/test/com/google/inject/JitBindingsTest.java
+++ b/core/test/com/google/inject/JitBindingsTest.java
@@ -323,8 +323,13 @@ public class JitBindingsTest extends TestCase {
});
ensureWorks(child, Foo.class, Bar.class);
ensureFails(child, ALLOW_BINDING, FooImpl.class);
- ensureInChild(parent, FooImpl.class, FooBar.class, Foo.class);
-
+ ensureInChild(parent, FooImpl.class, Foo.class);
+ // TODO(sameb): FooBar may or may not be in a child injector, depending on if GC has run.
+ // We should fix failed child injectors to remove their contents from the parent blacklist
+ // immediately, rather than waiting on GC to do it.
+ // FooBar was succesfully inserted into the child injector (and parent blacklist), but then
+ // JIT bindings it depended on failed, making the child injector invalid.
+
Injector grandchild = child.createChildInjector(new AbstractModule() {
@Override
protected void configure() {