Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow type parameters binding, with star type added #694

Open
matejdro opened this issue Feb 27, 2023 · 0 comments · May be fixed by #726
Open

Allow type parameters binding, with star type added #694

matejdro opened this issue Feb 27, 2023 · 0 comments · May be fixed by #726

Comments

@matejdro
Copy link

matejdro commented Feb 27, 2023

When attempting to multibind classes with type parameters:

@ContributesMultibinding(SomeScope::class)
class MyClass: SomeInterface<String>

Anvil will complain that Type parameters in bindings are not supported. This binding needs to be contributed in a Dagger module manually.

I understand that this is a problem, because Anvil can't know what type parameter should be used on bound type (there is no way to specify that in annotation). But, maybe we could just support the most basic version?

We could just add star to all type bindings, so above example would get bound to the SomeInterface<*> type. It does not cover many use cases, but I think it's still better than not supporting this at all. Any other non-star cases can still use module like now.

I'm willing to submit PR for this, if desired.

@matejdro matejdro linked a pull request Jul 21, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant