-
Notifications
You must be signed in to change notification settings - Fork 84
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 contributing bindings with generic supertypes #726
base: main
Are you sure you want to change the base?
Conversation
Anvil will always contribute bindings with all generic types filled as a star
For multibinding using However I'm wondering whether for regular bindings using the actual type parameter would make more sense. For example if I bind SQLDelight's ColumnAdpater, I'd probably would want the bound type for |
This was debated over and over again and there are other tickets discussing this. We didn't want to support this, because it adds inconsistency with
Which super type should be used is unclear, you'd need to use You can always support your use case with a custom code generator. |
For the As for the |
Added extra commits with above issues addressed. As part of this I also had to fix a bug in |
This has come up a few times on my team and we'd really like to have this functionality. Even if it doesn't fix every issue, it would be nice to at least do something, even if it's only generic supertypes for now. |
Any solution for this use case? |
I can look into solving conflicts and getting this into mergeable state if I get some feedback from Anvil team that this is actually something they want to get merged. They have been pretty silent so far. |
Instead of giving up, whenever user attempts to
@Contributes(Multi)Binding
on a generic parent interface, it will just bind to a variant of the parent interface with generic parameters filled as stars.It does not cover all use cases, but it covers more use cases than the old solution. And user can still use regular Module to achieve the rest of the use cases (like before), so this seems like a win win in my book.
This fixes #694.