We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Given I have a class with a type parameter:
abstract class MyFragment<T> : Fragment() { @Inject lateinit var something: Something
Anvil will generated a factory as:
class MyFragment_MembersInjector( private val param0: Provider<Something> ) : MembersInjector<MyFragment> { override fun injectMembers(instance: MyFragment) { injectSomething(instance, param0.get()) } companion object { @JvmStatic fun create(param0: Provider<Something>): MyFragment_MembersInjector = MyFragment_MembersInjector(param0) @JvmStatic @InjectedFieldSignature("com.foo.MyFragment") fun injectSomething(instance: MyFragment, something: Something) { instance.something = something } } }
which doesn't compile. I'm no expert, but I believe adding a <*> to the generated code when there's a type parameter should be enough to fix this
<*>
The text was updated successfully, but these errors were encountered:
Support generic classes that use field injection.
018e4c4
Fixes #91.
Thanks for taking care of this @vRallev, and thank you for Anvil, it's an awesome tool
Sorry, something went wrong.
Thanks for the easy sample to reproduce the issue.
I was trying version 2.0.2, it fixed most of the issues I've found, but the fix only works for single generic type. Opening a PR to fix it
vRallev
Successfully merging a pull request may close this issue.
Given I have a class with a type parameter:
Anvil will generated a factory as:
which doesn't compile. I'm no expert, but I believe adding a
<*>
to the generated code when there's a type parameter should be enough to fix thisThe text was updated successfully, but these errors were encountered: