eclipse-sisu / sisu-project

Sisu Inject
https://www.eclipse.org/sisu
Eclipse Public License 2.0
17 stars 15 forks source link

Consider supporting `Collection` types as injection target #93

Open cstamas opened 11 months ago

cstamas commented 11 months ago

Currently injected collection types supported are Set and List, but not Collection.

So something like this is currently not possible:

@Inject
public MyCtor(Collection<MyComponent> myComponents) {
...

Despite I may have Set or List injected. We may want to broaden and recognize these situations as Java would allow passing of Set or List into this ctor.

PS: This just came to my attention, as for example former Aether (Maven Resolver) is full of these: https://github.com/apache/maven-resolver/blob/maven-resolver-1.9.14/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultTransporterProvider.java#L58

(injects Set, only to pass to method using Collection and primate member is Collection as well).