Don't bind non-annotated types into DynamicSet, DynamicMap

When attaching implementations into a DynamicSet or DynamicMap,
only connect ones bound with an annotation. This enables code to
bind the interface twice, for example:

  class GroupModule extends AbstractModule {
	protected void configure() {
      DynamicSet.setOf(binder(), GroupBackend.class);
      DynamicSet.bind(binder(), GroupBackend.class).to(LdapBackend.class);

      bind(GroupBackend.class).to(UniversalBackend.class);
	}
  }

  class UniversalBackend implements GroupBackend {
    @Inject
	UniversalBackend(DynamicSet<GroupBackend> all) {
	}
  }

Without this no-annotation filter, the universal backend would
be added to its own DynamicSet and create a possible infinite
recursion scenario.

Change-Id: Ifcf08cc577acc7fc31d4eef0465d485e8878f4fc
2 files changed