Export the universal version of GroupBackend to plugins

Plugins like replication need to be able to see GroupBackend as bound
to UniversalGroupBackend. This was being filtered out of the inherited
Injector because DynamicSet<GroupBackend> was declared, and the
members of that set are not provided to plugins.

Change-Id: I78e57aaa2de52424d8a7abbaa6c1158032a9edab
This commit is contained in:
Shawn O. Pearce
2012-06-05 07:19:36 -07:00
parent 825900e7a3
commit 3379bc23eb

View File

@@ -385,8 +385,15 @@ public class PluginGuiceEnvironment {
final Map<Key<?>, Binding<?>> bindings = Maps.newLinkedHashMap();
for (Map.Entry<Key<?>, Binding<?>> e : src.getBindings().entrySet()) {
if (!dynamicTypes.contains(e.getKey().getTypeLiteral())
&& shouldCopy(e.getKey())) {
if (dynamicTypes.contains(e.getKey().getTypeLiteral())
&& e.getKey().getAnnotation() != null) {
// A type used in DynamicSet or DynamicMap that has an annotation
// must be picked up by the set/map itself. A type used in either
// but without an annotation may be magic glue implementing F and
// using DynamicSet<F> or DynamicMap<F> internally. That should be
// exported to plugins.
continue;
} else if (shouldCopy(e.getKey())) {
bindings.put(e.getKey(), e.getValue());
}
}