Blame SOURCES/0001-Revert-Some-work-on-issue-910-ensure-that-anonymous-.patch

249b5c
From 31b1e22561d5db89abfd09a8ecd9932d20f5eda3 Mon Sep 17 00:00:00 2001
249b5c
From: Mikolaj Izdebski <mizdebsk@redhat.com>
249b5c
Date: Mon, 18 May 2015 12:05:45 +0200
249b5c
Subject: [PATCH] Revert "Some work on issue 910 -- ensure that anonymous keys
249b5c
 & typeliterals don't"
249b5c
249b5c
This reverts commit 825f8c1df885b9d7643a9e18e336984f0138edaf.
249b5c
---
249b5c
 .../com/google/inject/internal/InjectorImpl.java   |  1 -
249b5c
 core/src/com/google/inject/internal/MoreTypes.java | 37 ++-----------------
249b5c
 core/src/com/google/inject/spi/Dependency.java     |  3 +-
249b5c
 core/src/com/google/inject/spi/Elements.java       | 14 +++----
249b5c
 core/test/com/google/inject/Asserts.java           | 42 ---------------------
249b5c
 core/test/com/google/inject/KeyTest.java           | 43 ----------------------
249b5c
 .../com/google/inject/internal/WeakKeySetTest.java | 11 +++++-
249b5c
 .../google/inject/internal/WeakKeySetUtils.java    | 42 +++++++++++++++++++++
249b5c
 .../google/inject/multibindings/MapBinderTest.java |  3 +-
249b5c
 .../inject/multibindings/OptionalBinderTest.java   |  3 +-
249b5c
 10 files changed, 62 insertions(+), 137 deletions(-)
249b5c
249b5c
diff --git a/core/src/com/google/inject/internal/InjectorImpl.java b/core/src/com/google/inject/internal/InjectorImpl.java
249b5c
index 54ce8a3..d260046 100644
249b5c
--- a/core/src/com/google/inject/internal/InjectorImpl.java
249b5c
+++ b/core/src/com/google/inject/internal/InjectorImpl.java
249b5c
@@ -801,7 +801,6 @@ final class InjectorImpl implements Injector, Lookups {
249b5c
       throw errors.childBindingAlreadySet(key, sources).toException();
249b5c
     }
249b5c
 
249b5c
-    key = MoreTypes.canonicalizeKey(key); // before storing the key long-term, canonicalize it.
249b5c
     BindingImpl<T> binding = createJustInTimeBinding(key, errors, jitDisabled, jitType);
249b5c
     state.parent().blacklist(key, state, binding.getSource());
249b5c
     jitBindings.put(key, binding);
249b5c
diff --git a/core/src/com/google/inject/internal/MoreTypes.java b/core/src/com/google/inject/internal/MoreTypes.java
249b5c
index bdf6029..12a7625 100644
249b5c
--- a/core/src/com/google/inject/internal/MoreTypes.java
249b5c
+++ b/core/src/com/google/inject/internal/MoreTypes.java
249b5c
@@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
249b5c
 import com.google.common.base.Objects;
249b5c
 import com.google.common.collect.ImmutableMap;
249b5c
 import com.google.inject.ConfigurationException;
249b5c
-import com.google.inject.Key;
249b5c
 import com.google.inject.TypeLiteral;
249b5c
 import com.google.inject.util.Types;
249b5c
 
249b5c
@@ -65,25 +64,6 @@ public class MoreTypes {
249b5c
           .build();
249b5c
 
249b5c
   /**
249b5c
-   * Returns a key that doesn't hold any references to parent classes.
249b5c
-   * This is necessary for anonymous keys, so ensure we don't hold a ref
249b5c
-   * to the containing module (or class) forever.
249b5c
-   */
249b5c
-  public static <T> Key<T> canonicalizeKey(Key<T> key) {
249b5c
-    // If we know this isn't a subclass, return as-is.
249b5c
-    // Otherwise, recreate the key to avoid the subclass 
249b5c
-    if (key.getClass() == Key.class) {
249b5c
-      return key;
249b5c
-    } else if (key.getAnnotation() != null) {
249b5c
-      return Key.get(key.getTypeLiteral(), key.getAnnotation());
249b5c
-    } else if (key.getAnnotationType() != null) {
249b5c
-      return Key.get(key.getTypeLiteral(), key.getAnnotationType());
249b5c
-    } else {
249b5c
-      return Key.get(key.getTypeLiteral());
249b5c
-    }
249b5c
-  }
249b5c
-
249b5c
-  /**
249b5c
    * Returns an type that's appropriate for use in a key.
249b5c
    *
249b5c
    * 

If the raw type of {@code typeLiteral} is a {@code javax.inject.Provider}, this returns a

249b5c
@@ -113,20 +93,9 @@ public class MoreTypes {
249b5c
 
249b5c
     @SuppressWarnings("unchecked")
249b5c
     TypeLiteral<T> wrappedPrimitives = (TypeLiteral<T>) PRIMITIVE_TO_WRAPPER.get(typeLiteral);
249b5c
-    if (wrappedPrimitives != null) {
249b5c
-      return wrappedPrimitives;
249b5c
-    }
249b5c
-
249b5c
-    // If we know this isn't a subclass, return as-is.
249b5c
-    if (typeLiteral.getClass() == TypeLiteral.class) {
249b5c
-      return typeLiteral;
249b5c
-    }
249b5c
-
249b5c
-    // recreate the TypeLiteral to avoid anonymous TypeLiterals from holding refs to their
249b5c
-    // surrounding classes.
249b5c
-    @SuppressWarnings("unchecked")
249b5c
-    TypeLiteral<T> recreated = (TypeLiteral<T>) TypeLiteral.get(typeLiteral.getType());
249b5c
-    return recreated;
249b5c
+    return wrappedPrimitives != null
249b5c
+        ? wrappedPrimitives
249b5c
+        : typeLiteral;
249b5c
   }
249b5c
 
249b5c
   /**
249b5c
diff --git a/core/src/com/google/inject/spi/Dependency.java b/core/src/com/google/inject/spi/Dependency.java
249b5c
index f86e255..c51d87c 100644
249b5c
--- a/core/src/com/google/inject/spi/Dependency.java
249b5c
+++ b/core/src/com/google/inject/spi/Dependency.java
249b5c
@@ -22,7 +22,6 @@ import com.google.common.base.Objects;
249b5c
 import com.google.common.collect.ImmutableSet;
249b5c
 import com.google.common.collect.Lists;
249b5c
 import com.google.inject.Key;
249b5c
-import com.google.inject.internal.MoreTypes;
249b5c
 
249b5c
 import java.util.List;
249b5c
 import java.util.Set;
249b5c
@@ -55,7 +54,7 @@ public final class Dependency<T> {
249b5c
    * nullable.
249b5c
    */
249b5c
   public static <T> Dependency<T> get(Key<T> key) {
249b5c
-    return new Dependency<T>(null, MoreTypes.canonicalizeKey(key), true, -1);
249b5c
+    return new Dependency<T>(null, key, true, -1);
249b5c
   }
249b5c
 
249b5c
   /**
249b5c
diff --git a/core/src/com/google/inject/spi/Elements.java b/core/src/com/google/inject/spi/Elements.java
249b5c
index 9348276..f5bbe89 100644
249b5c
--- a/core/src/com/google/inject/spi/Elements.java
249b5c
+++ b/core/src/com/google/inject/spi/Elements.java
249b5c
@@ -44,7 +44,6 @@ import com.google.inject.internal.ConstantBindingBuilderImpl;
249b5c
 import com.google.inject.internal.Errors;
249b5c
 import com.google.inject.internal.ExposureBuilder;
249b5c
 import com.google.inject.internal.InternalFlags.IncludeStackTraceOption;
249b5c
-import com.google.inject.internal.MoreTypes;
249b5c
 import com.google.inject.internal.PrivateElementsImpl;
249b5c
 import com.google.inject.internal.ProviderMethodsModule;
249b5c
 import com.google.inject.internal.util.SourceProvider;
249b5c
@@ -243,14 +242,13 @@ public final class Elements {
249b5c
 
249b5c
     @Override
249b5c
     public <T> void requestInjection(TypeLiteral<T> type, T instance) {
249b5c
-      elements.add(new InjectionRequest<T>(getElementSource(), MoreTypes.canonicalizeForKey(type),
249b5c
-          instance));
249b5c
+      elements.add(new InjectionRequest<T>(getElementSource(), type, instance));
249b5c
     }
249b5c
 
249b5c
     @Override
249b5c
     public <T> MembersInjector<T> getMembersInjector(final TypeLiteral<T> typeLiteral) {
249b5c
-      final MembersInjectorLookup<T> element = new MembersInjectorLookup<T>(getElementSource(),
249b5c
-          MoreTypes.canonicalizeForKey(typeLiteral));
249b5c
+      final MembersInjectorLookup<T> element
249b5c
+          = new MembersInjectorLookup<T>(getElementSource(), typeLiteral);
249b5c
       elements.add(element);
249b5c
       return element.getMembersInjector();
249b5c
     }
249b5c
@@ -372,8 +370,7 @@ public final class Elements {
249b5c
     }
249b5c
 
249b5c
     public <T> AnnotatedBindingBuilder<T> bind(Key<T> key) {
249b5c
-      BindingBuilder<T> builder =
249b5c
-          new BindingBuilder<T>(this, elements, getElementSource(), MoreTypes.canonicalizeKey(key));
249b5c
+      BindingBuilder<T> builder = new BindingBuilder<T>(this, elements, getElementSource(), key);
249b5c
       return builder;
249b5c
     }
249b5c
 
249b5c
@@ -483,8 +480,7 @@ public final class Elements {
249b5c
         };
249b5c
       }
249b5c
 
249b5c
-      ExposureBuilder<T> builder =
249b5c
-          new ExposureBuilder<T>(this, getElementSource(), MoreTypes.canonicalizeKey(key));
249b5c
+      ExposureBuilder<T> builder = new ExposureBuilder<T>(this, getElementSource(), key);
249b5c
       privateElements.addExposureBuilder(builder);
249b5c
       return builder;
249b5c
     }
249b5c
diff --git a/core/test/com/google/inject/Asserts.java b/core/test/com/google/inject/Asserts.java
249b5c
index 6c63158..363e161 100644
249b5c
--- a/core/test/com/google/inject/Asserts.java
249b5c
+++ b/core/test/com/google/inject/Asserts.java
249b5c
@@ -21,14 +21,12 @@ import static com.google.inject.internal.InternalFlags.IncludeStackTraceOption;
249b5c
 import static com.google.inject.internal.InternalFlags.getIncludeStackTraceOption;
249b5c
 import static junit.framework.Assert.assertEquals;
249b5c
 import static junit.framework.Assert.assertNotNull;
249b5c
-import static junit.framework.Assert.assertSame;
249b5c
 import static junit.framework.Assert.assertTrue;
249b5c
 
249b5c
 import com.google.common.base.Function;
249b5c
 import com.google.common.base.Joiner;
249b5c
 import com.google.common.collect.ImmutableList;
249b5c
 import com.google.common.collect.Iterables;
249b5c
-import com.google.common.testing.GcFinalization;
249b5c
 
249b5c
 import junit.framework.Assert;
249b5c
 
249b5c
@@ -38,8 +36,6 @@ import java.io.IOException;
249b5c
 import java.io.NotSerializableException;
249b5c
 import java.io.ObjectInputStream;
249b5c
 import java.io.ObjectOutputStream;
249b5c
-import java.lang.ref.ReferenceQueue;
249b5c
-import java.lang.ref.WeakReference;
249b5c
 
249b5c
 /**
249b5c
  * @author jessewilson@google.com (Jesse Wilson)
249b5c
@@ -163,42 +159,4 @@ public class Asserts {
249b5c
     } catch (NotSerializableException expected) {
249b5c
     }
249b5c
   }
249b5c
-
249b5c
-  public static void awaitFullGc() {
249b5c
-    // GcFinalization *should* do it, but doesn't work well in practice...
249b5c
-    // so we put a second latch and wait for a ReferenceQueue to tell us.
249b5c
-    ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
249b5c
-    WeakReference ref = new WeakReference<Object>(new Object(), queue);
249b5c
-    GcFinalization.awaitFullGc();
249b5c
-    try {
249b5c
-      assertSame("queue didn't return ref in time", ref, queue.remove(5000));
249b5c
-    } catch (IllegalArgumentException e) {
249b5c
-      throw new RuntimeException(e);
249b5c
-    } catch (InterruptedException e) {
249b5c
-      throw new RuntimeException(e);
249b5c
-    }
249b5c
-  }
249b5c
-
249b5c
-  public static void awaitClear(WeakReference ref) {
249b5c
-    // GcFinalization *should* do it, but doesn't work well in practice...
249b5c
-    // so we put a second latch and wait for a ReferenceQueue to tell us.
249b5c
-    Object data = ref.get();
249b5c
-    ReferenceQueue<Object> queue = null;
249b5c
-    WeakReference extraRef = null;
249b5c
-    if (data != null) {
249b5c
-      queue = new ReferenceQueue<Object>();
249b5c
-      extraRef = new WeakReference<Object>(data, queue);
249b5c
-      data = null;
249b5c
-    }
249b5c
-    GcFinalization.awaitClear(ref);
249b5c
-    if (queue != null) {
249b5c
-      try {
249b5c
-        assertSame("queue didn't return ref in time", extraRef, queue.remove(5000));
249b5c
-      } catch (IllegalArgumentException e) {
249b5c
-        throw new RuntimeException(e);
249b5c
-      } catch (InterruptedException e) {
249b5c
-        throw new RuntimeException(e);
249b5c
-      }
249b5c
-    }
249b5c
-  }
249b5c
 }
249b5c
diff --git a/core/test/com/google/inject/KeyTest.java b/core/test/com/google/inject/KeyTest.java
249b5c
index d9dd943..c0401e0 100644
249b5c
--- a/core/test/com/google/inject/KeyTest.java
249b5c
+++ b/core/test/com/google/inject/KeyTest.java
249b5c
@@ -19,12 +19,10 @@ package com.google.inject;
249b5c
 import static com.google.inject.Asserts.assertContains;
249b5c
 import static com.google.inject.Asserts.assertEqualsBothWays;
249b5c
 import static com.google.inject.Asserts.assertNotSerializable;
249b5c
-import static com.google.inject.Asserts.awaitClear;
249b5c
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
249b5c
 
249b5c
 import com.google.inject.name.Named;
249b5c
 import com.google.inject.name.Names;
249b5c
-import com.google.inject.spi.Dependency;
249b5c
 import com.google.inject.util.Types;
249b5c
 
249b5c
 import junit.framework.TestCase;
249b5c
@@ -33,15 +31,12 @@ import java.io.IOException;
249b5c
 import java.lang.annotation.ElementType;
249b5c
 import java.lang.annotation.Retention;
249b5c
 import java.lang.annotation.Target;
249b5c
-import java.lang.ref.WeakReference;
249b5c
 import java.lang.reflect.Method;
249b5c
 import java.lang.reflect.ParameterizedType;
249b5c
 import java.lang.reflect.Type;
249b5c
 import java.lang.reflect.TypeVariable;
249b5c
-import java.util.ArrayList;
249b5c
 import java.util.List;
249b5c
 import java.util.Map;
249b5c
-import java.util.concurrent.atomic.AtomicReference;
249b5c
 
249b5c
 /**
249b5c
  * @author crazybob@google.com (Bob Lee)
249b5c
@@ -280,42 +275,4 @@ public class KeyTest extends TestCase {
249b5c
   @Marker
249b5c
   class HasAnnotations {}
249b5c
 
249b5c
-  public void testAnonymousClassesDontHoldRefs() {
249b5c
-    final AtomicReference<Provider<List<String>>> stringProvider =
249b5c
-        new AtomicReference<Provider<List<String>>>();
249b5c
-    final AtomicReference<Provider<List<Integer>>> intProvider =
249b5c
-        new AtomicReference<Provider<List<Integer>>>();
249b5c
-    final Object foo = new Object() {
249b5c
-      @SuppressWarnings("unused") @Inject List<String> list;
249b5c
-    };
249b5c
-    Module module = new AbstractModule() {
249b5c
-      @Override protected void configure() {
249b5c
-        bind(new Key<List<String>>() {}).toInstance(new ArrayList<String>());
249b5c
-        bind(new TypeLiteral<List<Integer>>() {}).toInstance(new ArrayList<Integer>());
249b5c
-
249b5c
-        stringProvider.set(getProvider(new Key<List<String>>() {}));
249b5c
-        intProvider.set(binder().getProvider(Dependency.get(new Key<List<Integer>>() {})));
249b5c
-
249b5c
-        binder().requestInjection(new TypeLiteral<Object>() {}, foo);
249b5c
-      }
249b5c
-    };
249b5c
-    WeakReference<Module> moduleRef = new WeakReference<Module>(module);
249b5c
-    final Injector injector = Guice.createInjector(module);
249b5c
-    module = null;
249b5c
-    awaitClear(moduleRef); // Make sure anonymous keys & typeliterals don't hold the module.
249b5c
-
249b5c
-    Runnable runner = new Runnable() {
249b5c
-      @Override public void run() {
249b5c
-        injector.getInstance(new Key<Typed<String>>() {});
249b5c
-        injector.getInstance(Key.get(new TypeLiteral<Typed<Integer>>() {}));
249b5c
-      }
249b5c
-    };
249b5c
-    WeakReference<Runnable> runnerRef = new WeakReference<Runnable>(runner);
249b5c
-    runner.run();
249b5c
-    runner = null;
249b5c
-    awaitClear(runnerRef); // also make sure anonymous keys & typeliterals don't hold for JITs
249b5c
-  }
249b5c
-
249b5c
-  static class Typed<T> {}
249b5c
-
249b5c
 }
249b5c
diff --git a/core/test/com/google/inject/internal/WeakKeySetTest.java b/core/test/com/google/inject/internal/WeakKeySetTest.java
249b5c
index 4a81ebb..3797d88 100644
249b5c
--- a/core/test/com/google/inject/internal/WeakKeySetTest.java
249b5c
+++ b/core/test/com/google/inject/internal/WeakKeySetTest.java
249b5c
@@ -16,13 +16,13 @@
249b5c
 
249b5c
 package com.google.inject.internal;
249b5c
 
249b5c
-import static com.google.inject.Asserts.awaitClear;
249b5c
-import static com.google.inject.Asserts.awaitFullGc;
249b5c
 import static com.google.inject.internal.WeakKeySetUtils.assertBlacklisted;
249b5c
 import static com.google.inject.internal.WeakKeySetUtils.assertInSet;
249b5c
 import static com.google.inject.internal.WeakKeySetUtils.assertNotBlacklisted;
249b5c
 import static com.google.inject.internal.WeakKeySetUtils.assertNotInSet;
249b5c
 import static com.google.inject.internal.WeakKeySetUtils.assertSourceNotInSet;
249b5c
+import static com.google.inject.internal.WeakKeySetUtils.awaitClear;
249b5c
+import static com.google.inject.internal.WeakKeySetUtils.awaitFullGc;
249b5c
 
249b5c
 import com.google.common.collect.ImmutableList;
249b5c
 import com.google.common.collect.ImmutableMap;
249b5c
@@ -34,6 +34,13 @@ import com.google.inject.Injector;
249b5c
 import com.google.inject.Key;
249b5c
 import com.google.inject.Scope;
249b5c
 import com.google.inject.TypeLiteral;
249b5c
+import com.google.inject.internal.BindingImpl;
249b5c
+import com.google.inject.internal.Errors;
249b5c
+/*if[AOP]*/
249b5c
+import com.google.inject.internal.MethodAspect;
249b5c
+/*end[AOP]*/
249b5c
+import com.google.inject.internal.State;
249b5c
+import com.google.inject.internal.WeakKeySet;
249b5c
 import com.google.inject.spi.ModuleAnnotatedMethodScannerBinding;
249b5c
 import com.google.inject.spi.ProvisionListenerBinding;
249b5c
 import com.google.inject.spi.ScopeBinding;
249b5c
diff --git a/core/test/com/google/inject/internal/WeakKeySetUtils.java b/core/test/com/google/inject/internal/WeakKeySetUtils.java
249b5c
index b023aa1..bab9e92 100644
249b5c
--- a/core/test/com/google/inject/internal/WeakKeySetUtils.java
249b5c
+++ b/core/test/com/google/inject/internal/WeakKeySetUtils.java
249b5c
@@ -18,11 +18,15 @@ import static junit.framework.Assert.assertEquals;
249b5c
 import static junit.framework.Assert.assertFalse;
249b5c
 import static junit.framework.Assert.assertNotNull;
249b5c
 import static junit.framework.Assert.assertNull;
249b5c
+import static junit.framework.Assert.assertSame;
249b5c
 import static junit.framework.Assert.assertTrue;
249b5c
 
249b5c
+import com.google.common.testing.GcFinalization;
249b5c
 import com.google.inject.Injector;
249b5c
 import com.google.inject.Key;
249b5c
 
249b5c
+import java.lang.ref.ReferenceQueue;
249b5c
+import java.lang.ref.WeakReference;
249b5c
 import java.util.Set;
249b5c
 
249b5c
 /**
249b5c
@@ -34,6 +38,44 @@ public final class WeakKeySetUtils {
249b5c
 
249b5c
   private WeakKeySetUtils() {}
249b5c
 
249b5c
+  public static void awaitFullGc() {
249b5c
+    // GcFinalization *should* do it, but doesn't work well in practice...
249b5c
+    // so we put a second latch and wait for a ReferenceQueue to tell us.
249b5c
+    ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
249b5c
+    WeakReference ref = new WeakReference<Object>(new Object(), queue);
249b5c
+    GcFinalization.awaitFullGc();
249b5c
+    try {
249b5c
+      assertSame("queue didn't return ref in time", ref, queue.remove(5000));
249b5c
+    } catch (IllegalArgumentException e) {
249b5c
+      throw new RuntimeException(e);
249b5c
+    } catch (InterruptedException e) {
249b5c
+      throw new RuntimeException(e);
249b5c
+    }
249b5c
+  }
249b5c
+
249b5c
+  public static void awaitClear(WeakReference ref) {
249b5c
+    // GcFinalization *should* do it, but doesn't work well in practice...
249b5c
+    // so we put a second latch and wait for a ReferenceQueue to tell us.
249b5c
+    Object data = ref.get();
249b5c
+    ReferenceQueue<Object> queue = null;
249b5c
+    WeakReference extraRef = null;
249b5c
+    if (data != null) {
249b5c
+      queue = new ReferenceQueue<Object>();
249b5c
+      extraRef = new WeakReference<Object>(data, queue);
249b5c
+      data = null;
249b5c
+    }
249b5c
+    GcFinalization.awaitClear(ref);
249b5c
+    if (queue != null) {
249b5c
+      try {
249b5c
+        assertSame("queue didn't return ref in time", extraRef, queue.remove(5000));
249b5c
+      } catch (IllegalArgumentException e) {
249b5c
+        throw new RuntimeException(e);
249b5c
+      } catch (InterruptedException e) {
249b5c
+        throw new RuntimeException(e);
249b5c
+      }
249b5c
+    }
249b5c
+  }
249b5c
+
249b5c
   public static void assertBlacklisted(Injector injector, Key key) {
249b5c
     assertBlacklistState(injector, key, true);
249b5c
   }
249b5c
diff --git a/extensions/multibindings/test/com/google/inject/multibindings/MapBinderTest.java b/extensions/multibindings/test/com/google/inject/multibindings/MapBinderTest.java
249b5c
index 4206521..849993f 100644
249b5c
--- a/extensions/multibindings/test/com/google/inject/multibindings/MapBinderTest.java
249b5c
+++ b/extensions/multibindings/test/com/google/inject/multibindings/MapBinderTest.java
249b5c
@@ -32,7 +32,6 @@ import com.google.common.collect.Iterables;
249b5c
 import com.google.common.collect.Maps;
249b5c
 import com.google.common.collect.Sets;
249b5c
 import com.google.inject.AbstractModule;
249b5c
-import com.google.inject.Asserts;
249b5c
 import com.google.inject.Binding;
249b5c
 import com.google.inject.BindingAnnotation;
249b5c
 import com.google.inject.ConfigurationException;
249b5c
@@ -1026,7 +1025,7 @@ public class MapBinderTest extends TestCase {
249b5c
     // Clear the ref, GC, and ensure that we are no longer blacklisting.
249b5c
     childInjector = null;
249b5c
     
249b5c
-    Asserts.awaitClear(weakRef);
249b5c
+    WeakKeySetUtils.awaitClear(weakRef);
249b5c
     WeakKeySetUtils.assertNotBlacklisted(parentInjector, mapKey);
249b5c
   }
249b5c
 }
249b5c
diff --git a/extensions/multibindings/test/com/google/inject/multibindings/OptionalBinderTest.java b/extensions/multibindings/test/com/google/inject/multibindings/OptionalBinderTest.java
249b5c
index f3c9f63..d0a239a 100644
249b5c
--- a/extensions/multibindings/test/com/google/inject/multibindings/OptionalBinderTest.java
249b5c
+++ b/extensions/multibindings/test/com/google/inject/multibindings/OptionalBinderTest.java
249b5c
@@ -30,7 +30,6 @@ import com.google.common.collect.Iterables;
249b5c
 import com.google.common.collect.Lists;
249b5c
 import com.google.common.collect.Sets;
249b5c
 import com.google.inject.AbstractModule;
249b5c
-import com.google.inject.Asserts;
249b5c
 import com.google.inject.Binding;
249b5c
 import com.google.inject.BindingAnnotation;
249b5c
 import com.google.inject.CreationException;
249b5c
@@ -1204,7 +1203,7 @@ public class OptionalBinderTest extends TestCase {
249b5c
    // Clear the ref, GC, and ensure that we are no longer blacklisting.
249b5c
    childInjector = null;
249b5c
    
249b5c
-   Asserts.awaitClear(weakRef);
249b5c
+   WeakKeySetUtils.awaitClear(weakRef);
249b5c
    WeakKeySetUtils.assertNotBlacklisted(parentInjector, Key.get(Integer.class));
249b5c
  }
249b5c
 
249b5c
-- 
249b5c
2.1.0
249b5c