Repository: square/anvil
Issue: [Dagger factories] Type parameters are not allowed for objects

I've the code, and try to generate dagger's factories with Anvil on modules without components:
```kotlin
interface BaseModel

class NewsModel: BaseModel

class FeedModel: BaseModel

class HtmlToRawMapper<T : BaseModel> @Inject constructor(): ObservableTransformer<List<T>, List<T>> {
    override fun apply(upstream: Observable<List<T>>): ObservableSource<List<T>> = 
upstream.flatMapIterable { it }.toList().toObservable()
}

----- 
interface Repository

class FeedListRepository: Repository

class NewsListRepository: Repository

-----
@Module
object NewsModule {

    @Provide
    fun provideNewsRepository(
        mapper: HtmlToRawMapper<NewsModel>
    ): Repository = NewsListRepository(mapper)

}

@Module
object FeedModule {

    @Provide
    fun provideFeedRepository(
        mapper: HtmlToRawMapper<FeedModel>
    ): Repository = FeedListRepository(mapper)
}
```

and build failed with:
```
e: /domain/build/anvil/src-gen-release/domain/repository/base/HtmlToRawMapper_Factory.kt: (12, 55): Type parameters are not allowed for objects
e: /domain/build/anvil/src-gen-release/domain/repository/base/HtmlToRawMapper_Factory.kt: (17, 90): Type mismatch: inferred type is HtmlToRawMapper_Factory<T#2 (type parameter of domain.repository.base.HtmlToRawMapper_Factory)> but HtmlToRawMapper_Factory<T#1 (type parameter of domain.repository.base.HtmlToRawMapper_Factory.create)> was expected
```

as result Anvil generate:
```kotlin
public object HtmlToRawMapper_Factory<T : BaseModel> :
    Factory<HtmlToRawMapper<T>> {
  public override fun `get`(): HtmlToRawMapper<T> = newInstance()

  @JvmStatic
  public fun <T : BaseModel> create(): HtmlToRawMapper_Factory<T> = this

  @JvmStatic
  public fun <T : BaseModel> newInstance(): HtmlToRawMapper<T> =
      HtmlToRawMapper<T>()
}
```

but if I add a fake constructor dependency:
```kotlin
class HtmlToRawMapper<T : BaseModel> @Inject constructor(
    private val fakeDeps: Context
): ObservableTransformer<List<T>, List<T>> {
    override fun apply(upstream: Observable<List<T>>): ObservableSource<List<T>> = 
upstream.flatMapIterable { it }.toList().toObservable()
}
```
it become compiling fine.

Changed files:
compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/InjectConstructorFactoryGenerator.kt
compiler/src/test/java/com/squareup/anvil/compiler/dagger/InjectConstructorFactoryGeneratorTest.kt

diff --git a/compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/InjectConstructorFactoryGenerator.kt b/compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/InjectConstructorFactoryGenerator.kt
index b2b2922..6de5afa 100644
--- a/compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/InjectConstructorFactoryGenerator.kt
+++ b/compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/InjectConstructorFactoryGenerator.kt
@@ -84,7 +84,7 @@ internal class InjectConstructorFactoryGenerator : PrivateCodeGenerator() {
     }
 
     val content = FileSpec.buildFile(packageName, className) {
-      val canGenerateAnObject = parameters.isEmpty()
+      val canGenerateAnObject = parameters.isEmpty() && typeParameters.isEmpty()
       val classBuilder = if (canGenerateAnObject) {
         TypeSpec.objectBuilder(factoryClass)
       } else {
diff --git a/compiler/src/test/java/com/squareup/anvil/compiler/dagger/InjectConstructorFactoryGeneratorTest.kt b/compiler/src/test/java/com/squareup/anvil/compiler/dagger/InjectConstructorFactoryGeneratorTest.kt
index d298b91..d930b07 100644
--- a/compiler/src/test/java/com/squareup/anvil/compiler/dagger/InjectConstructorFactoryGeneratorTest.kt
+++ b/compiler/src/test/java/com/squareup/anvil/compiler/dagger/InjectConstructorFactoryGeneratorTest.kt
@@ -1506,6 +1506,60 @@ public final class InjectClass_Factory<T> implements Factory<InjectClass<T>> {
     }
   }
 
+  @Test fun `a factory class is generated for a class with a type parameter no constructor argument`() {
+    /*
+package com.squareup.test;
+
+import dagger.internal.DaggerGenerated;
+import dagger.internal.Factory;
+import javax.annotation.processing.Generated;
+
+@DaggerGenerated
+@Generated(
+    value = "dagger.internal.codegen.ComponentProcessor",
+    comments = "https://dagger.dev"
+)
+@SuppressWarnings({
+    "unchecked",
+    "rawtypes"
+})
+public final class InjectClass_Factory<T> implements Factory<InjectClass<T>> {
+  @Override
+  public InjectClass<T> get() {
+    return newInstance();
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <T> InjectClass_Factory<T> create() {
+    return InstanceHolder.INSTANCE;
+  }
+
+  public static <T> InjectClass<T> newInstance() {
+    return new InjectClass<T>();
+  }
+
+  private static final class InstanceHolder {
+    @SuppressWarnings("rawtypes")
+    private static final InjectClass_Factory INSTANCE = new InjectClass_Factory();
+  }
+}
+     */
+
+    compile(
+      """
+      package com.squareup.test
+      
+      import javax.inject.Inject
+      
+      class InjectClass<T> @Inject constructor()
+      """
+    ) {
+      val constructor = classLoader.loadClass("com.squareup.test.InjectClass")
+        .factoryClass().declaredConstructors.single()
+      assertThat(constructor.parameterTypes.toList()).isEmpty()
+    }
+  }
+
   @Test fun `a factory class is generated for generics without modifier`() {
     /*
 package com.squareup.test;