anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: square/wire
Issue: Don't use KClass.simpleName in EnumConstantNotFoundException

This requires usage of `kotlin-reflect`, which is too big for Android apps.

Changed files:
wire-runtime/src/jvmMain/kotlin/com/squareup/wire/ProtoAdapter.kt

diff --git a/wire-runtime/src/jvmMain/kotlin/com/squareup/wire/ProtoAdapter.kt b/wire-runtime/src/jvmMain/kotlin/com/squareup/wire/ProtoAdapter.kt
index 116884df8..75d12aef7 100644
--- a/wire-runtime/src/jvmMain/kotlin/com/squareup/wire/ProtoAdapter.kt
+++ b/wire-runtime/src/jvmMain/kotlin/com/squareup/wire/ProtoAdapter.kt
@@ -137,7 +137,7 @@ actual abstract class ProtoAdapter<E> actual constructor(
   actual class EnumConstantNotFoundException actual constructor(
     @JvmField actual val value: Int,
     type: KClass<*>?
-  ) : IllegalArgumentException("Unknown enum tag $value for ${type?.simpleName}") {
+  ) : IllegalArgumentException("Unknown enum tag $value for ${type?.java?.name}") {
     constructor(value: Int, type: Class<*>): this(value, type.kotlin)
   }
Repository: square/wire
Issue: Generated Kotlin code with member `adapter` is hiding supertype member

## About:
If the proto definition contains field named `adapter` it will cause that the generated Kotlin code will contain conflicting member.

This is caused by the fact that `nameAllocatorStore` in `KotlinGenerator` is [set only with the constant variant (uppercase)](https://github.com/square/wire/blob/7aab9195bf1c898d355b117a9b5e3c954219789f/wire-library/wire-kotlin-generator/src/main/java/com/squareup/wire/kotlin/KotlinGenerator.kt#L257) of the member name but in the supertype `Message` it is defined lowercase.

## Example proto:
```proto
message Broken {

    // This will hide supertype member
    optional string adapter = 1;

    // This is changed to `unknownFields_`
    repeated string unknownFields = 2;
}
```

This issue is present in current master (3.2.0-SNAPSHOT).

Changed files:
wire-library/wire-kotlin-generator/src/main/java/com/squareup/wire/kotlin/KotlinGenerator.kt
wire-library/wire-kotlin-generator/src/test/java/com/squareup/wire/kotlin/KotlinGeneratorTest.kt

diff --git a/wire-library/wire-kotlin-generator/src/main/java/com/squareup/wire/kotlin/KotlinGenerator.kt b/wire-library/wire-kotlin-generator/src/main/java/com/squareup/wire/kotlin/KotlinGenerator.kt
index bf2aabc29..a170f509d 100644
--- a/wire-library/wire-kotlin-generator/src/main/java/com/squareup/wire/kotlin/KotlinGenerator.kt
+++ b/wire-library/wire-kotlin-generator/src/main/java/com/squareup/wire/kotlin/KotlinGenerator.kt
@@ -295,6 +295,7 @@ class KotlinGenerator private constructor(
           is MessageType -> {
             newName("unknownFields", "unknownFields")
             newName("ADAPTER", "ADAPTER")
+            newName("adapter", "adapter")
             newName("reader", "reader")
             newName("Builder", "Builder")
             newName("builder", "builder")
diff --git a/wire-library/wire-kotlin-generator/src/test/java/com/squareup/wire/kotlin/KotlinGeneratorTest.kt b/wire-library/wire-kotlin-generator/src/test/java/com/squareup/wire/kotlin/KotlinGeneratorTest.kt
index 366be2fd8..91e18784a 100644
--- a/wire-library/wire-kotlin-generator/src/test/java/com/squareup/wire/kotlin/KotlinGeneratorTest.kt
+++ b/wire-library/wire-kotlin-generator/src/test/java/com/squareup/wire/kotlin/KotlinGeneratorTest.kt
@@ -76,10 +76,12 @@ class KotlinGeneratorTest {
         |message Message {
         |  required float when = 1;
         |  required int32 ADAPTER = 2;
+        |  optional int64 adapter = 3;
         |}""".trimMargin())
     val code = repoBuilder.generateKotlin("Message")
     assertTrue(code.contains("val when_: Float"))
     assertTrue(code.contains("val ADAPTER_: Int"))
+    assertTrue(code.contains("val adapter_: Long?"))
     assertTrue(code.contains("ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.when_) +"))
     assertTrue(code.contains("ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.when_)"))
     assertTrue(code.contains("ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.when_)"))
Repository: square/wire
Issue: Don't use java.lang.UnsupportedOperationException in generated code

There's a similar Kotlin type that should be used to keep generated code platform-agnostic

Changed files:
wire-kotlin-generator/src/main/java/com/squareup/wire/kotlin/KotlinGenerator.kt
wire-tests/src/jvmTest/proto-kotlin/com/squareup/wire/protos/kotlin/redacted/RedactedRequired.kt

diff --git a/wire-kotlin-generator/src/main/java/com/squareup/wire/kotlin/KotlinGenerator.kt b/wire-kotlin-generator/src/main/java/com/squareup/wire/kotlin/KotlinGenerator.kt
index 1f314c17b..62d28b6bb 100644
--- a/wire-kotlin-generator/src/main/java/com/squareup/wire/kotlin/KotlinGenerator.kt
+++ b/wire-kotlin-generator/src/main/java/com/squareup/wire/kotlin/KotlinGenerator.kt
@@ -843,7 +843,7 @@ class KotlinGenerator private constructor(
     if (requiredRedactedMessageFields.isNotEmpty()) {
       result.addStatement(
           "throw %T(%S)",
-          UnsupportedOperationException::class,
+          ClassName("kotlin", "UnsupportedOperationException"),
           requiredRedactedMessageFields.joinToString(
               prefix = if (requiredRedactedMessageFields.size > 1) "Fields [" else "Field '",
               postfix = if (requiredRedactedMessageFields.size > 1) "] are " else "' is " +
diff --git a/wire-tests/src/jvmTest/proto-kotlin/com/squareup/wire/protos/kotlin/redacted/RedactedRequired.kt b/wire-tests/src/jvmTest/proto-kotlin/com/squareup/wire/protos/kotlin/redacted/RedactedRequired.kt
index bfdc6ea6b..7f94e26ac 100644
--- a/wire-tests/src/jvmTest/proto-kotlin/com/squareup/wire/protos/kotlin/redacted/RedactedRequired.kt
+++ b/wire-tests/src/jvmTest/proto-kotlin/com/squareup/wire/protos/kotlin/redacted/RedactedRequired.kt
@@ -9,13 +9,13 @@ import com.squareup.wire.ProtoReader
 import com.squareup.wire.ProtoWriter
 import com.squareup.wire.WireField
 import com.squareup.wire.internal.missingRequiredFields
-import java.lang.UnsupportedOperationException
 import kotlin.AssertionError
 import kotlin.Deprecated
 import kotlin.DeprecationLevel
 import kotlin.Int
 import kotlin.Nothing
 import kotlin.String
+import kotlin.UnsupportedOperationException
 import kotlin.jvm.JvmField
 import okio.ByteString
Repository: square/wire
Issue: (Android) grpc-client and runtime both define 'Util.kt'

AFAIK Android support for 3.0.0 is not yet ready so maybe this is known, but I tried crunching through to see where I'd get stuck anyway :)

Because both modules define `com.squareup.wire.internal.Util`, on the latest SNAPSHOT builds (and alpha) Android builds fail with:

```
Duplicate class com.squareup.wire.internal.UtilKt found in modules wire-grpc-client-3.0.0-SNAPSHOT.jar (com.squareup.wire:wire-grpc-client:3.0.0-SNAPSHOT:20190809.205059-66) and wire-runtime-3.0.0-SNAPSHOT.jar (com.squareup.wire:wire-runtime:3.0.0-SNAPSHOT)
```

*Edit:* this was the only issue blocking Android from making a successful gRPC call with grpc-client. I managed to make a successful call after changing the namespace to something more specific.




Changed files:
wire-runtime/src/commonMain/kotlin/com/squareup/wire/internal/Util.kt, wire-grpc-client/src/main/java/com/squareup/wire/internal/util.kt

diff --git a/wire-grpc-client/src/main/java/com/squareup/wire/internal/util.kt b/wire-grpc-client/src/main/java/com/squareup/wire/internal/util.kt
index 4f1ef5c5a..8fa3c123d 100644
--- a/wire-grpc-client/src/main/java/com/squareup/wire/internal/util.kt
+++ b/wire-grpc-client/src/main/java/com/squareup/wire/internal/util.kt
@@ -13,6 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+@file:JvmName("GrpcUtils")
+
 package com.squareup.wire.internal
 
 import kotlinx.coroutines.CoroutineScope
diff --git a/wire-runtime/src/commonMain/kotlin/com/squareup/wire/internal/Util.kt b/wire-runtime/src/commonMain/kotlin/com/squareup/wire/internal/Util.kt
index 0f8521715..c81fe0745 100644
--- a/wire-runtime/src/commonMain/kotlin/com/squareup/wire/internal/Util.kt
+++ b/wire-runtime/src/commonMain/kotlin/com/squareup/wire/internal/Util.kt
@@ -13,8 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+@file:JvmName("RuntimeUtils")
+
 package com.squareup.wire.internal
 
+import kotlin.jvm.JvmName
+
 @Suppress("NOTHING_TO_INLINE") // Syntactic sugar.
 internal inline infix fun Byte.and(other: Int): Int = toInt() and other
Repository: square/kotlinpoet
Issue: Percentage at the end of parameter kdoc removes line break

If you do something like this:
```
val parameterSpec1 = parameterSpecBuilder1.addKdoc("Progress in %%").build()
val parameterSpec2 = parameterSpecBuilder2.addKdoc("Some other parameter with %%").build()
funSpecBuilder.addParameters(listOf(parameterSpec1, parameterSpec2))
```

The output will be (one line)
```
* @param param1Name Progress in %@param param2Name Some other parameter with % */
```
Instead of (three lines)
```
* @param param1Name Progress in %
* @param param2Name Some other parameter with % 
*/
```

Changed files:
kotlinpoet/src/main/java/com/squareup/kotlinpoet/Util.kt, kotlinpoet/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt

diff --git a/kotlinpoet/src/main/java/com/squareup/kotlinpoet/Util.kt b/kotlinpoet/src/main/java/com/squareup/kotlinpoet/Util.kt
index bc2d36aa..1722fd12 100644
--- a/kotlinpoet/src/main/java/com/squareup/kotlinpoet/Util.kt
+++ b/kotlinpoet/src/main/java/com/squareup/kotlinpoet/Util.kt
@@ -172,17 +172,15 @@ internal val String.isKeyword get() = this in KEYWORDS
 internal val String.isName get() = split("\\\\.").none { it.isKeyword }
 
 internal fun CodeBlock.ensureEndsWithNewLine() = if (isEmpty()) this else with(toBuilder()) {
-  val lastFormatPart = formatParts.last()
-  if (CodeBlock.isPlaceholder(lastFormatPart)) {
-    if (args.isEmpty()) {
-      return@with build()
-    }
+  val lastFormatPart = trim().formatParts.last()
+  if (CodeBlock.isPlaceholder(lastFormatPart) && args.isNotEmpty()) {
     val lastArg = args.last()
     if (lastArg is String) {
       args[args.size - 1] = lastArg.trimEnd('\\n') + '\\n'
     }
   } else {
-    formatParts[formatParts.size - 1] = lastFormatPart.trimEnd('\\n') + '\\n'
+    formatParts[formatParts.lastIndexOf(lastFormatPart)] = lastFormatPart.trimEnd('\\n')
+    formatParts += "\\n"
   }
   return@with build()
 }
diff --git a/kotlinpoet/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt b/kotlinpoet/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
index 8e245c5c..826da72d 100644
--- a/kotlinpoet/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
+++ b/kotlinpoet/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
@@ -893,4 +893,25 @@ class KotlinPoetTest {
               .build().toString()
     }.hasMessageThat().isEqualTo("Can't escape identifier `with.dots` because it contains illegal characters: .")
   }
+
+  // https://github.com/square/kotlinpoet/issues/814
+  @Test fun percentAtTheEndOfKdoc() {
+    val paramSpec1 = ParameterSpec.builder("a", Int::class)
+        .addKdoc("Progress in %%")
+        .build()
+    val paramSpec2 = ParameterSpec.builder("b", Int::class)
+        .addKdoc("Some other parameter with %%")
+        .build()
+    val funSpec = FunSpec.builder("test")
+        .addParameters(listOf(paramSpec1, paramSpec2))
+        .build()
+    assertThat(funSpec.toString()).isEqualTo("""
+      |/**
+      | * @param a Progress in %
+      | * @param b Some other parameter with %
+      | */
+      |fun test(a: kotlin.Int, b: kotlin.Int) {
+      |}
+      |""".trimMargin())
+  }
 }
Repository: square/kotlinpoet
Issue: Import aliases must not be on separate lines

Aliasing imports with very long package names causes the alias to be put on a new line, which is a syntax error.

The problem looks like this:

```kotlin
import this.is.a.very.long.imported.package.with.a.function.i.need.to.rename.from.function as
  importedFunction123
```

But the generated code needs to look like this:

```kotlin
import this.is.a.very.long.imported.package.with.a.function.i.need.to.rename.from.function as importedFunction123
```


Changed files:
kotlinpoet/src/main/java/com/squareup/kotlinpoet/Import.kt, kotlinpoet/src/test/java/com/squareup/kotlinpoet/FileSpecTest.kt

diff --git a/kotlinpoet/src/main/java/com/squareup/kotlinpoet/Import.kt b/kotlinpoet/src/main/java/com/squareup/kotlinpoet/Import.kt
index c0c06e88..28f65aba 100644
--- a/kotlinpoet/src/main/java/com/squareup/kotlinpoet/Import.kt
+++ b/kotlinpoet/src/main/java/com/squareup/kotlinpoet/Import.kt
@@ -23,7 +23,7 @@ public data class Import internal constructor(
   private val importString = buildString {
     append(qualifiedName.escapeSegmentsIfNecessary())
     if (alias != null) {
-      append(" as ${alias.escapeIfNecessary()}")
+      append("·as·${alias.escapeIfNecessary()}")
     }
   }
 
diff --git a/kotlinpoet/src/test/java/com/squareup/kotlinpoet/FileSpecTest.kt b/kotlinpoet/src/test/java/com/squareup/kotlinpoet/FileSpecTest.kt
index 61a69bd3..2ac486bf 100644
--- a/kotlinpoet/src/test/java/com/squareup/kotlinpoet/FileSpecTest.kt
+++ b/kotlinpoet/src/test/java/com/squareup/kotlinpoet/FileSpecTest.kt
@@ -1026,6 +1026,20 @@ class FileSpecTest {
     )
   }
 
+  @Test fun importAliasedLongPackageName() {
+    val spec = FileSpec.builder("testsrc", "Test")
+      .addAliasedImport(ClassName("a.really.veryveryveryveryveryveryvery.long.pkgname.that.will.definitely.cause.a.wrap.duetoitslength", "MyClass"), "MyClassAlias")
+      .build()
+    assertThat(spec.toString()).isEqualTo(
+      """
+      |package testsrc
+      |
+      |import a.really.veryveryveryveryveryveryvery.long.pkgname.that.will.definitely.cause.a.wrap.duetoitslength.MyClass as MyClassAlias
+      |
+      |""".trimMargin()
+    )
+  }
+
   @Test fun longComment() {
     val file = FileSpec.builder("com.squareup.tacos", "Taco")
       .addComment(
Repository: square/kotlinpoet
Issue: Impossible to generate valid keyword enum, 1.4.4

kotlinpoet: 1.4.4

```kotlin
FileSpec
      .builder("a", "a")
      .addType(
        TypeSpec
          .enumBuilder("MyEnum")
          .addEnumConstant("object")
          .build()
      )
      .build()
      .writeTo(File("a"))
```

This fails with

```
java.lang.IllegalArgumentException: not a valid enum constant: MyEnum
	at com.squareup.kotlinpoet.TypeSpec$Builder.build(TypeSpec.kt:656)
```

1. Error message should contain invalid enum value as well as the type
2. If I add backtics to object string manually, kotlinpoet generates enum value with double backtics

Changed files:
kotlinpoet/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt, kotlinpoet/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt

diff --git a/kotlinpoet/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt b/kotlinpoet/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
index 29ac0fff..6aab46cb 100644
--- a/kotlinpoet/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
+++ b/kotlinpoet/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
@@ -89,7 +89,12 @@ class TypeSpec private constructor(
     return builder
   }
 
-  internal fun emit(codeWriter: CodeWriter, enumName: String?, implicitModifiers: Set<KModifier> = emptySet(), isNestedExternal: Boolean = false) {
+  internal fun emit(
+    codeWriter: CodeWriter,
+    enumName: String?,
+    implicitModifiers: Set<KModifier> = emptySet(),
+    isNestedExternal: Boolean = false
+  ) {
     // Nested classes interrupt wrapped line indentation. Stash the current wrapping state and put
     // it back afterwards when this type is complete.
     val previousStatementLine = codeWriter.statementLine
@@ -673,10 +678,7 @@ class TypeSpec private constructor(
 
     fun build(): TypeSpec {
       if (enumConstants.isNotEmpty()) {
-        check(isEnum) { "${this.name} is not enum and cannot have enum constants" }
-        for (it in enumConstants.keys) {
-          require(it.isName) { "not a valid enum constant: $name" }
-        }
+        check(isEnum) { "$name is not an enum and cannot have enum constants" }
       }
 
       if (superclassConstructorParameters.isNotEmpty()) {
diff --git a/kotlinpoet/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt b/kotlinpoet/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
index 8f67cae5..57e5280c 100644
--- a/kotlinpoet/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
+++ b/kotlinpoet/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
@@ -4018,6 +4018,21 @@ class TypeSpecTest {
         |""".trimMargin())
   }
 
+  // https://github.com/square/kotlinpoet/issues/848
+  @Test fun escapeEnumConstantNames() {
+    val enum = TypeSpec
+        .enumBuilder("MyEnum")
+        .addEnumConstant("object")
+        .build()
+    assertThat(toString(enum)).isEqualTo("""
+      |package com.squareup.tacos
+      |
+      |enum class MyEnum {
+      |  `object`
+      |}
+      |""".trimMargin())
+  }
+
   companion object {
     private val donutsPackage = "com.squareup.donuts"
   }
Repository: square/kotlinpoet
Issue: Don't break line between parameter name and type

Example of generated code:
```kotlin
fun scheduled_transaction_preference(scheduled_transaction_preference:
        ScheduledTransactionPreference?): Builder {
```

Changed files:
src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt, src/main/java/com/squareup/kotlinpoet/ParameterSpec.kt, src/main/java/com/squareup/kotlinpoet/FunSpec.kt

diff --git a/src/main/java/com/squareup/kotlinpoet/FunSpec.kt b/src/main/java/com/squareup/kotlinpoet/FunSpec.kt
index e32106bd..967ce711 100644
--- a/src/main/java/com/squareup/kotlinpoet/FunSpec.kt
+++ b/src/main/java/com/squareup/kotlinpoet/FunSpec.kt
@@ -75,7 +75,7 @@ class FunSpec private constructor(builder: Builder) {
     codeWriter.emitModifiers(modifiers, implicitModifiers)
 
     if (!isConstructor && !name.isAccessor) {
-      codeWriter.emit("fun ")
+      codeWriter.emitCode("fun·")
     }
 
     if (typeVariables.isNotEmpty()) {
@@ -97,7 +97,7 @@ class FunSpec private constructor(builder: Builder) {
     if (asExpressionBody != null) {
       codeWriter.emitCode(" = %L", asExpressionBody)
     } else if (!isEmptySetter) {
-      codeWriter.emit(" {\\n")
+      codeWriter.emitCode("·{\\n")
       codeWriter.indent()
       codeWriter.emitCode(body)
       codeWriter.unindent()
diff --git a/src/main/java/com/squareup/kotlinpoet/ParameterSpec.kt b/src/main/java/com/squareup/kotlinpoet/ParameterSpec.kt
index a651cc6b..f86abdcf 100644
--- a/src/main/java/com/squareup/kotlinpoet/ParameterSpec.kt
+++ b/src/main/java/com/squareup/kotlinpoet/ParameterSpec.kt
@@ -34,7 +34,7 @@ class ParameterSpec private constructor(builder: ParameterSpec.Builder) {
     codeWriter.emitAnnotations(annotations, true)
     codeWriter.emitModifiers(modifiers)
     if (name.isNotEmpty()) codeWriter.emitCode("%L", name.escapeIfNecessary())
-    if (name.isNotEmpty() && includeType) codeWriter.emit(": ")
+    if (name.isNotEmpty() && includeType) codeWriter.emitCode(":·")
     if (includeType) codeWriter.emitCode("%T", type)
     emitDefaultValue(codeWriter)
   }
diff --git a/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt b/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
index accf2fd1..1d6daf39 100644
--- a/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
+++ b/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
@@ -745,4 +745,21 @@ class KotlinPoetTest {
       |class AlarmInfo(val `when`: Float)
       |""".trimMargin())
   }
+
+  // https://github.com/square/kotlinpoet/issues/577
+  @Test fun noWrappingBetweenParamNameAndType() {
+    val file = FileSpec.builder("com.squareup.tacos", "Taco")
+        .addFunction(FunSpec.builder("functionWithAPrettyLongNameThatWouldCauseWrapping")
+            .addParameter("parameterWithALongNameThatWouldAlsoCauseWrapping", String::class)
+            .build())
+        .build()
+    assertThat(file.toString()).isEqualTo("""
+      |package com.squareup.tacos
+      |
+      |import kotlin.String
+      |
+      |fun functionWithAPrettyLongNameThatWouldCauseWrapping(parameterWithALongNameThatWouldAlsoCauseWrapping: String) {
+      |}
+      |""".trimMargin())
+  }
 }
Repository: square/kotlinpoet
Issue: Enum constants with spaces are not escaped properly

For instance:
```
TypeSpec.enumBuilder("MyEnum")
  .addEnumConstant("test test")
  .addEnumConstant("0constants")
  .addEnumConstant("with.dots") // dots are illegal, so this should fail
  .build()
```

The first one contains space, the second one starts with digit, so both should be escaped with backticks.






Changed files:
src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt, src/main/java/com/squareup/kotlinpoet/TypeSpec.kt

diff --git a/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt b/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
index b292f5b4..05c09193 100644
--- a/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
+++ b/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
@@ -98,7 +98,7 @@ class TypeSpec private constructor(
       if (enumName != null) {
         codeWriter.emitKdoc(kdocWithConstructorParameters())
         codeWriter.emitAnnotations(annotationSpecs, false)
-        codeWriter.emitCode("%L", enumName)
+        codeWriter.emitCode("%N", enumName)
         if (superclassConstructorParametersBlock.isNotEmpty()) {
           codeWriter.emit("(")
           codeWriter.emitCode(superclassConstructorParametersBlock)
@@ -209,8 +209,7 @@ class TypeSpec private constructor(
       while (i.hasNext()) {
         val enumConstant = i.next()
         if (!firstMember) codeWriter.emit("\\n")
-        enumConstant.value
-            .emit(codeWriter, enumConstant.key)
+        enumConstant.value.emit(codeWriter, enumConstant.key)
         firstMember = false
         if (i.hasNext()) codeWriter.emit(",\\n")
       }
diff --git a/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt b/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
index bf933b98..ae1531f6 100644
--- a/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
+++ b/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
@@ -3773,6 +3773,21 @@ class TypeSpecTest {
     assertThat(outer.originatingElements).containsExactly(outerElement, innerElement)
   }
 
+  // https://github.com/square/kotlinpoet/issues/698
+  @Test fun escapeEnumConstants() {
+    val enum = TypeSpec.enumBuilder("MyEnum")
+        .addEnumConstant("test test")
+        .addEnumConstant("0constants")
+        .build()
+    assertThat(enum.toString()).isEqualTo("""
+      |enum class MyEnum {
+      |  `test test`,
+      |
+      |  `0constants`
+      |}
+      |""".trimMargin())
+  }
+
   companion object {
     private val donutsPackage = "com.squareup.donuts"
   }
Repository: square/kotlinpoet
Issue: Interface delegation doesn't work for objects

This code checks for `isSimpleClass` which doesn't cover `object`s.
Interface delegation does work fine with `object`s in Kotlin though.

https://github.com/square/kotlinpoet/blob/d5877b03e15983e5ea48f8446728d9ce98c215f3/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt#L506-L512

Changed files:
src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt, src/main/java/com/squareup/kotlinpoet/TypeSpec.kt

diff --git a/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt b/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
index efa959f4..51c9d3b4 100644
--- a/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
+++ b/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
@@ -508,8 +508,8 @@ class TypeSpec private constructor(builder: TypeSpec.Builder) {
       if (delegate.isEmpty()) {
         this.superinterfaces[superinterface] = null
       } else {
-        require(isSimpleClass) {
-          "delegation only allowed for classes (found $kind '$name')"
+        require(isSimpleClass || kind == Kind.OBJECT) {
+          "delegation only allowed for classes and objects (found $kind '$name')"
         }
         require(!superinterface.isNullable) {
           "expected non-nullable type but was '${superinterface.copy(nullable = false)}'"
diff --git a/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt b/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
index 877a1d9b..0b4ce95b 100644
--- a/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
+++ b/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
@@ -3209,6 +3209,25 @@ class TypeSpecTest {
     assertThat(toString(type)).isEqualTo(expect)
   }
 
+  @Test fun testDelegateOnObject() {
+    val type = TypeSpec.objectBuilder("Guac")
+        .addSuperinterface(
+            Consumer::class.parameterizedBy(String::class),
+            CodeBlock.of("({ println(it) })"))
+        .build()
+
+    val expect = """
+        |package com.squareup.tacos
+        |
+        |import java.util.function.Consumer
+        |import kotlin.String
+        |
+        |object Guac : Consumer<String> by ({ println(it) })
+        |""".trimMargin()
+
+    assertThat(toString(type)).isEqualTo(expect)
+  }
+
   @Test fun testMultipleDelegates() {
     val type = TypeSpec.classBuilder("StringToInteger")
         .primaryConstructor(FunSpec.constructorBuilder()
Repository: square/kotlinpoet
Issue: Don't break line between val/var and property name

Example of generated code:
```kotlin
@WireField(tag = 2, adapter = "ScheduledTransactionPreference.ADAPTER") val
        scheduled_transaction_preference: ScheduledTransactionPreference? = null,
```

Changed files:
src/main/java/com/squareup/kotlinpoet/PropertySpec.kt, src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt

diff --git a/src/main/java/com/squareup/kotlinpoet/PropertySpec.kt b/src/main/java/com/squareup/kotlinpoet/PropertySpec.kt
index 71ee5a15..49f1fc98 100644
--- a/src/main/java/com/squareup/kotlinpoet/PropertySpec.kt
+++ b/src/main/java/com/squareup/kotlinpoet/PropertySpec.kt
@@ -59,7 +59,7 @@ class PropertySpec private constructor(builder: Builder) {
     }
     codeWriter.emitAnnotations(annotations, inline)
     codeWriter.emitModifiers(propertyModifiers, implicitModifiers)
-    codeWriter.emit(if (mutable) "var " else "val ")
+    codeWriter.emitCode(if (mutable) "var·" else "val·")
     if (typeVariables.isNotEmpty()) {
       codeWriter.emitTypeVariables(typeVariables)
       codeWriter.emit(" ")
diff --git a/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt b/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
index 1d6daf39..fe41239c 100644
--- a/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
+++ b/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
@@ -762,4 +762,34 @@ class KotlinPoetTest {
       |}
       |""".trimMargin())
   }
+
+  // https://github.com/square/kotlinpoet/issues/576
+  @Test fun noWrappingBetweenValAndPropertyName() {
+    val wireField = ClassName("com.squareup.wire", "WireField")
+    val file = FileSpec.builder("com.squareup.tacos", "Taco")
+        .addType(TypeSpec.classBuilder("Taco")
+            .addModifiers(KModifier.DATA)
+            .addProperty(PropertySpec.builder("name", String::class)
+                .addAnnotation(AnnotationSpec.builder(wireField)
+                    .addMember("tag = %L", 1)
+                    .addMember("adapter = %S", "CustomStringAdapterWithALongNameThatCauses")
+                    .build())
+                .initializer("name")
+                .build())
+            .primaryConstructor(FunSpec.constructorBuilder()
+                .addParameter(ParameterSpec.builder("name", String::class)
+                    .build())
+                .build())
+            .build())
+        .build()
+    assertThat(file.toString()).isEqualTo("""
+      |package com.squareup.tacos
+      |
+      |import com.squareup.wire.WireField
+      |import kotlin.String
+      |
+      |data class Taco(@WireField(tag = 1, adapter = "CustomStringAdapterWithALongNameThatCauses")
+      |        val name: String)
+      |""".trimMargin())
+  }
 }
Repository: square/kotlinpoet
Issue: Enum without entries

I'm trying to generate enums for a type safe vulkan wrapper and some of the enums have no entries as they might be added in future.
Can this use case be supported?
Currently I get `java.lang.IllegalArgumentException: at least one enum constant is required for RenderPassCreate`

Changed files:
src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt, src/main/java/com/squareup/kotlinpoet/TypeSpec.kt

diff --git a/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt b/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
index 8d56bebf..175821f9 100644
--- a/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
+++ b/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
@@ -611,10 +611,6 @@ class TypeSpec private constructor(builder: TypeSpec.Builder) {
         "typevariables are forbidden on anonymous types"
       }
 
-      require(!isEnum || enumConstants.isNotEmpty()) {
-        "at least one enum constant is required for $name"
-      }
-
       val isAbstract = ABSTRACT in modifiers || SEALED in modifiers || kind != Kind.CLASS || !isSimpleClass
       for (funSpec in funSpecs) {
         require(isAbstract || ABSTRACT !in funSpec.modifiers) {
diff --git a/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt b/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
index 1a713cb1..d7683488 100644
--- a/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
+++ b/src/test/java/com/squareup/kotlinpoet/TypeSpecTest.kt
@@ -546,13 +546,6 @@ class TypeSpecTest {
         |""".trimMargin())
   }
 
-  @Test fun enumConstantsRequired() {
-    assertThrows<IllegalArgumentException> {
-      TypeSpec.enumBuilder("Roshambo")
-          .build()
-    }
-  }
-
   @Test fun onlyEnumsMayHaveEnumConstants() {
     assertThrows<IllegalStateException> {
       TypeSpec.classBuilder("Roshambo")
@@ -3566,6 +3559,15 @@ class TypeSpecTest {
     assertThat(builder.build().superclassConstructorParameters).containsExactly(seasoning)
   }
 
+  // https://github.com/square/kotlinpoet/issues/565
+  @Test fun markerEnum() {
+    val spec = TypeSpec.enumBuilder("Topping")
+        .build()
+    assertThat(spec.toString()).isEqualTo("""
+      |enum class Topping
+      |""".trimMargin())
+  }
+
   companion object {
     private val donutsPackage = "com.squareup.donuts"
   }
Repository: square/kotlinpoet
Issue: Primary constructor parameter with escaped name doesn't get matched with the corresponding initializer

I generate a type like so:

```kotlin
val typeBuilder = TypeSpec.classBuilder(name)
    .addProperties(properties.map {
        PropertySpec
            .varBuilder(it.key, parameterType(it.key, it.value))
            .initializer(it.key)
            .build()
    })
    .primaryConstructor(FunSpec.constructorBuilder()
        .addParameters(
            properties.map {
                ParameterSpec
                    .builder(it.key, parameterType(it.key, it.value))
                    .build()
            }
        )
        .build())
```

and get the following result

```kotlin
class AlarmInfo(
    `when`: Float? = null,
    var delayInMinutes: Float? = null,
    var periodInMinutes: Float? = null
) {
    var `when`: Float? = when
}
```

If I manually escape the .initializer(it.key) part, it works. Still, not optimal.

Follow up to #477 


Changed files:
src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt, src/main/java/com/squareup/kotlinpoet/TypeSpec.kt

diff --git a/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt b/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
index 5aebe2c1..fb7aaae3 100644
--- a/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
+++ b/src/main/java/com/squareup/kotlinpoet/TypeSpec.kt
@@ -287,7 +287,8 @@ class TypeSpec private constructor(builder: TypeSpec.Builder) {
     for (property in propertySpecs) {
       val parameter = primaryConstructor.parameter(property.name) ?: continue
       if (parameter.type != property.type) continue
-      if (CodeBlock.of("%N", parameter) != property.initializer) continue
+      if (CodeBlock.of("%N", parameter) != CodeBlock.of("%N", property.initializer.toString()))
+        continue
 
       result[property.name] = property.fromPrimaryConstructorParameter(parameter)
     }
diff --git a/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt b/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
index 69a12d09..33d53c0b 100644
--- a/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
+++ b/src/test/java/com/squareup/kotlinpoet/KotlinPoetTest.kt
@@ -723,4 +723,25 @@ class KotlinPoetTest {
       |)
       |""".trimMargin())
   }
+
+  // https://github.com/square/kotlinpoet/issues/483
+  @Test fun foldingPropertyWithEscapedName() {
+    val file = FileSpec.builder("com.squareup.tacos", "AlarmInfo")
+        .addType(TypeSpec.classBuilder("AlarmInfo")
+            .primaryConstructor(FunSpec.constructorBuilder()
+                .addParameter("when", Float::class)
+                .build())
+            .addProperty(PropertySpec.builder("when", Float::class)
+                .initializer("when")
+                .build())
+            .build())
+        .build()
+    assertThat(file.toString()).isEqualTo("""
+      |package com.squareup.tacos
+      |
+      |import kotlin.Float
+      |
+      |class AlarmInfo(val `when`: Float)
+      |""".trimMargin())
+  }
 }
Repository: netflix/dgs-framework
Issue: bug: Mocking of DataFetchers is broken in 5.2.1

After the introducing duplicate validator https://github.com/Netflix/dgs-framework/pull/1202
mock on DataFetchers stopped working.

Repro:
https://github.com/nkonev/dgs.issue.repro (5.1.1)

Update version from 5.1.1 to 5.2.1 in gradle, then run the tests again.

Example of output
```
Caused by: com.netflix.graphql.dgs.exceptions.InvalidDgsConfigurationException: Duplicate data fetchers registered for Query.car
```

Changed files:
graphql-dgs/src/main/kotlin/com/netflix/graphql/dgs/internal/DgsSchemaProvider.kt

diff --git a/graphql-dgs/src/main/kotlin/com/netflix/graphql/dgs/internal/DgsSchemaProvider.kt b/graphql-dgs/src/main/kotlin/com/netflix/graphql/dgs/internal/DgsSchemaProvider.kt
index 64c3c1d6..38096a6a 100644
--- a/graphql-dgs/src/main/kotlin/com/netflix/graphql/dgs/internal/DgsSchemaProvider.kt
+++ b/graphql-dgs/src/main/kotlin/com/netflix/graphql/dgs/internal/DgsSchemaProvider.kt
@@ -62,6 +62,7 @@ import java.util.*
 import java.util.concurrent.CompletableFuture
 import java.util.concurrent.CompletionStage
 import java.util.concurrent.locks.ReentrantReadWriteLock
+import java.util.stream.Collectors
 import kotlin.concurrent.read
 import kotlin.concurrent.write
 
@@ -256,15 +257,19 @@ class DgsSchemaProvider(
         dgsComponents.forEach { dgsComponent ->
             val javaClass = AopUtils.getTargetClass(dgsComponent)
             ReflectionUtils.getUniqueDeclaredMethods(javaClass, ReflectionUtils.USER_DECLARED_METHODS).asSequence()
-                .filter { method ->
-                    MergedAnnotations
+                .map { method ->
+                    val mergedAnnotations = MergedAnnotations
                         .from(method, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY)
-                        .isPresent(DgsData::class.java)
+                    Pair(method, mergedAnnotations)
                 }
-                .forEach { method ->
-                    val mergedAnnotations =
-                        MergedAnnotations.from(method, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY)
-                    mergedAnnotations.stream(DgsData::class.java).forEach { dgsDataAnnotation ->
+                .filter { (_, mergedAnnotations) -> mergedAnnotations.isPresent(DgsData::class.java) }
+                .forEach { (method, mergedAnnotations) ->
+                    val filteredMergedAnnotations =
+                        mergedAnnotations
+                            .stream(DgsData::class.java)
+                            .filter { (it.source as Method).declaringClass == method.declaringClass }
+                            .collect(Collectors.toList())
+                    filteredMergedAnnotations.forEach { dgsDataAnnotation ->
                         registerDataFetcher(
                             typeDefinitionRegistry,
                             codeRegistryBuilder,
Repository: cashapp/paparazzi
Issue: Wear Screenshot should only be round for full screen

**Description**

https://github.com/cashapp/paparazzi/blob/b2332237aafc78862c1bc5627bf6b6279f258b63/paparazzi/paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt#L375-L385

Is not nuanced enough.  Just checking the device shape isn't enough, when it might not be a full screen screenshot.

**Steps to Reproduce**

Use a scrolling screenshot or similar, an oval shape will be applied.

**Expected behavior**

Only full screen screenshots are circle cropped.

**Additional information:**
- Paparazzi Version: 1.1



Changed files:
paparazzi/paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt

diff --git a/paparazzi/paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt b/paparazzi/paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt
index e3d36113..7ff1de78 100644
--- a/paparazzi/paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt
+++ b/paparazzi/paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt
@@ -373,7 +373,8 @@ class Paparazzi @JvmOverloads constructor(
   }
 
   private fun frameImage(image: BufferedImage): BufferedImage {
-    if (deviceConfig.screenRound == ScreenRound.ROUND) {
+    // On device sized screenshot, we should apply any device specific shapes.
+    if (renderingMode == RenderingMode.NORMAL && deviceConfig.screenRound == ScreenRound.ROUND) {
       val newImage = BufferedImage(image.width, image.height, image.type)
       val g = newImage.createGraphics()
       g.clip = Ellipse2D.Float(0f, 0f, image.height.toFloat(), image.width.toFloat())
Repository: cashapp/paparazzi
Issue: java.lang.ClassCastException with compose-runtime 1.4.0-alpha02

**Description**
Paparazzi tests fail with `java.lang.ClassCastException` when using compose-runtime 1.4.0-alpha02

**Steps to Reproduce**
- Update compose-runtime to 1.4.0-alpha02
- Try to run a Paparazzi test

**Additional information:**
The internals of `Recomposer.kt` were recently [updated](https://android-review.googlesource.com/c/platform/frameworks/support/+/2258823), which [changed](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt;l=203;drc=98f2641f492c7ffc91e77e39d60b77909669f0ea) the type of `snapshotInvalidations` from a `val MutableList` to a `var MutableSet`.

Paparazzi retrieves this field by reflection and [casts](https://github.com/cashapp/paparazzi/blob/c7c19125fa05f044c5d865f42f970776f3171fd8/paparazzi/paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt) it to a `MutableList`, which causes a `java.lang.ClassCastException` due to the update.

Changed files:
paparazzi/paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt

diff --git a/paparazzi/paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt b/paparazzi/paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt
index 01fc9c72..5c91f4db 100644
--- a/paparazzi/paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt
+++ b/paparazzi/paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt
@@ -572,7 +572,7 @@ class Paparazzi @JvmOverloads constructor(
       val snapshotInvalidations = recomposer.javaClass
         .getDeclaredField("snapshotInvalidations")
         .apply { isAccessible = true }
-        .get(recomposer) as MutableList<*>
+        .get(recomposer) as MutableCollection<*>
       compositionInvalidations.clear()
       snapshotInvalidations.clear()
       applyObservers.clear()
Repository: carlosesco/neko
Issue: [bug] Filters Main Dropdown minimize issue

This issue is caused in browse section of the app, When you scroll down in filter and try to minimize the main dropdown headers (theme) they dont minimize which leads to scrolling upwards for a long time 

**To Reproduce**
Steps to reproduce the behavior:
1. Go to 'Browse section'
2. Click on '☰'
3. Scroll down to bottom. 
4. Try to minimize main dropdown header 

**Expected behavior**
When clicking on Main Dropdown Header, It should minimize reducing time in scrolling 


Changed files:
app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/GroupItem.kt, app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/SortGroup.kt

diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/GroupItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/GroupItem.kt
index 1e99d53f8..def59eb78 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/GroupItem.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/GroupItem.kt
@@ -49,7 +49,7 @@ class GroupItem(val filter: Filter.Group<*>) : AbstractExpandableHeaderItem<Grou
                         .colorInt(Color.WHITE)
                         .sizeDp(16))
 
-        holder.itemView.setOnClickListener(holder)
+        holder.contentView.setOnClickListener(holder)
 
     }
 
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/SortGroup.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/SortGroup.kt
index d91126caf..e30a32069 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/SortGroup.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/SortGroup.kt
@@ -45,7 +45,7 @@ class SortGroup(val filter: Filter.Sort) : AbstractExpandableHeaderItem<SortGrou
                         .icon(icon)
                         .colorInt(Color.WHITE).sizeDp(16))
 
-        holder.itemView.setOnClickListener(holder)
+        holder.contentView.setOnClickListener(holder)
 
     }
Repository: autonomousapps/dependency-analysis-android-gradle-plugin
Issue: Redundant transitive dependencies report

In 0.50.0, I have this report generated:

```
Unused dependencies which should be removed:
- api(deps.workflow.legacy.rx2)

Transitively used dependencies that should be declared directly as indicated:
- api(deps.okio)
- api(deps.workflow.legacy.core)
- api(deps.workflow.core)
- api(deps.kotlin.stdlib_jdk6_do_not_use)
- implementation(deps.okio) // duplicate
- implementation(deps.workflow.legacy.core) // duplicate
- implementation(deps.workflow.core) // duplicate
- implementation(deps.kotlin.stdlib_jdk6_do_not_use) // duplicate
```

Changed files:
src/main/kotlin/com/autonomousapps/internal/advice/ComputedAdvice.kt

diff --git a/src/main/kotlin/com/autonomousapps/internal/advice/ComputedAdvice.kt b/src/main/kotlin/com/autonomousapps/internal/advice/ComputedAdvice.kt
index ed8414c5..5f004264 100644
--- a/src/main/kotlin/com/autonomousapps/internal/advice/ComputedAdvice.kt
+++ b/src/main/kotlin/com/autonomousapps/internal/advice/ComputedAdvice.kt
@@ -34,6 +34,12 @@ internal class ComputedAdvice(
 
   val addToImplAdvice: Set<Advice> = undeclaredImplDependencies
     .filterToOrderedSet(filterSpec.addAdviceFilter)
+    // Remove any dependencies that are in the add-to-api set
+    .filterToOrderedSet { trans ->
+      addToApiAdvice.none { api ->
+        api.dependency == trans.dependency
+      }
+    }
     .mapToOrderedSet { Advice.ofAdd(it, "implementation") }
 
   val removeAdvice: Set<Advice> = unusedComponents
Repository: autonomousapps/dependency-analysis-android-gradle-plugin
Issue: False positive unused dependency when used only by generated Dagger code

**Plugin version**
1.7.0

**Gradle version**
7.4.2

**(Optional) Android Gradle Plugin (AGP) version**
7.1.3

**`reason` output for bugs relating to incorrect advice**
```
> Task :lib:reason

----------------------------------------
You asked about the dependency 'com.squareup.android:truststore:1.10.0'.
You have been advised to remove this dependency from 'implementation'.
----------------------------------------

Shortest path from :lib to com.squareup.android:truststore:1.10.0 for debugCompileClasspath:
:lib
\\--- com.squareup.android:truststore:1.10.0

Source: debug, main
-------------------
(no usages)
```

**Describe the bug**
```
./gradlew lib:projectHealth
...
> Task :lib:compileDebugJavaWithJavac FAILED
lib/build/generated/source/kapt/debug/sqip/internal/DaggerLibActivityComponent.java:7: error: package com.squareup.common.truststore does not exist
import com.squareup.common.truststore.SquareTruststore;
                                     ^
lib/build/generated/source/kapt/debug/sqip/internal/DaggerLibActivityComponent.java:59: error: cannot find symbol
  private Provider<SquareTruststore> squareTruststoreProvider;
                   ^
  symbol:   class SquareTruststore
  location: class DaggerBuyerVerificationActivityComponent
lib/build/generated/source/kapt/debug/sqip/internal/DaggerLibActivityComponent.java:133: error: cannot access SquareTruststore
    this.squareTruststoreProvider = DoubleCheck.provider(HttpModule_SquareTruststoreFactory.create(AndroidModule_ApplicationFactory.create()));
                                               ^
  class file for com.squareup.common.truststore.SquareTruststore not found
3 errors
```

**To Reproduce**
See above.

**Expected behavior**
Plugin should detect this usage.

Changed files:
src/main/kotlin/com/autonomousapps/internal/asm.kt

diff --git a/src/main/kotlin/com/autonomousapps/internal/asm.kt b/src/main/kotlin/com/autonomousapps/internal/asm.kt
index cc5ec7a2..039eb576 100644
--- a/src/main/kotlin/com/autonomousapps/internal/asm.kt
+++ b/src/main/kotlin/com/autonomousapps/internal/asm.kt
@@ -4,6 +4,7 @@ import com.autonomousapps.internal.ClassNames.canonicalize
 import com.autonomousapps.internal.asm.*
 import com.autonomousapps.internal.utils.METHOD_DESCRIPTOR_REGEX
 import com.autonomousapps.internal.utils.efficient
+import com.autonomousapps.internal.utils.genericTypes
 import kotlinx.metadata.jvm.KotlinClassHeader
 import org.gradle.api.logging.Logger
 import java.util.concurrent.atomic.AtomicReference
@@ -204,6 +205,10 @@ internal class ClassAnalyzer(private val logger: Logger) : ClassVisitor(ASM_VERS
   ): FieldVisitor {
     log("ClassAnalyzer#visitField: $descriptor $name")
     addClass(descriptor)
+    // TODO probably do this for other `visitX` methods as well
+    signature?.genericTypes()?.forEach {
+      addClass(it)
+    }
     return fieldAnalyzer
   }