Repository: square/anvil (kotlin)

Issue:
Incorrect factory generated for class with type parameters
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

Pull request:
Fixes #91

Patch:
diff --git a/compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/MembersInjectorGenerator.kt b/compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/MembersInjectorGenerator.kt
index be1f980a5..6d96d2c06 100644
--- a/compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/MembersInjectorGenerator.kt
+++ b/compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/MembersInjectorGenerator.kt
@@ -74,7 +74,9 @@ internal class MembersInjectorGenerator : CodeGenerator {
     val classType = clazz.asTypeName()
         .let {
           if (it is ClassName && clazz.isGenericClass()) {
-            it.parameterizedBy(STAR)
+            val numberOfStars = clazz.typeParameterList!!.parameters.size
+            val stars = Array(numberOfStars) { STAR }
+            it.parameterizedBy(*stars)
           } else {
             it
           }


Test patch:
diff --git a/compiler/src/test/java/com/squareup/anvil/compiler/dagger/MembersInjectorGeneratorTest.kt b/compiler/src/test/java/com/squareup/anvil/compiler/dagger/MembersInjectorGeneratorTest.kt
index 584a29dcf..580a8c8f3 100644
--- a/compiler/src/test/java/com/squareup/anvil/compiler/dagger/MembersInjectorGeneratorTest.kt
+++ b/compiler/src/test/java/com/squareup/anvil/compiler/dagger/MembersInjectorGeneratorTest.kt
@@ -617,6 +617,64 @@ public final class InjectClass_MembersInjector<T> implements MembersInjector<Inj
     }
   }
 
+  @Test fun `a factory class is generated for a field injection with three generic classes`() {
+    /*
+package com.squareup.test;
+
+import dagger.MembersInjector;
+import dagger.internal.InjectedFieldSignature;
+import javax.annotation.Generated;
+import javax.inject.Provider;
+
+@Generated(
+    value = "dagger.internal.codegen.ComponentProcessor",
+    comments = "https://dagger.dev"
+)
+@SuppressWarnings({
+    "unchecked",
+    "rawtypes"
+})
+public final class InjectClass_MembersInjector<T, U, V> implements MembersInjector<InjectClass<T, U, V>> {
+  private final Provider<String> stringProvider;
+
+  public InjectClass_MembersInjector(Provider<String> stringProvider) {
+    this.stringProvider = stringProvider;
+  }
+
+  public static <T, U, V> MembersInjector<InjectClass<T>> create(Provider<String> stringProvider) {
+    return new InjectClass_MembersInjector<T>(stringProvider);}
+
+  @Override
+  public void injectMembers(InjectClass<T, U, V> instance) {
+    injectString(instance, stringProvider.get());
+  }
+
+  @InjectedFieldSignature("com.squareup.test.InjectClass.string")
+  public static <T> void injectString(InjectClass<T, U, V> instance, String string) {
+    instance.string = string;
+  }
+}
+     */
+
+    compile(
+      """
+        package com.squareup.test
+        
+        import javax.inject.Inject
+        
+        abstract class InjectClass<T, U, V> {
+          @Inject lateinit var string: String
+        }
+        """
+    ) {
+      val membersInjector = injectClass.membersInjector()
+
+      val constructor = membersInjector.declaredConstructors.single()
+      assertThat(constructor.parameterTypes.toList())
+        .containsExactly(Provider::class.java)
+    }
+  }
+
   @OptIn(ExperimentalStdlibApi::class)
   private fun Class<*>.staticInjectMethod(memberName: String): Method {
     // We can't check the @InjectedFieldSignature annotation unfortunately, because it has class