aboutsummaryrefslogtreecommitdiff
path: root/kotlinpoet
diff options
context:
space:
mode:
authorZac Sweers <zac.sweers@gmail.com>2021-08-27 00:55:14 -0400
committerGitHub <noreply@github.com>2021-08-27 00:55:14 -0400
commitcb2206364437b56888e2c16b1f82a43e94b11417 (patch)
treeeff9b923928293020b2a213353d4b6c34017c767 /kotlinpoet
parentf331d53048bcf0ee4b65fca23e09e1c5e9ceeec5 (diff)
downloadkotlinpoet-cb2206364437b56888e2c16b1f82a43e94b11417.tar.gz
Use delicate APIs rather than noisy logging ones (#1136)
Diffstat (limited to 'kotlinpoet')
-rw-r--r--kotlinpoet/src/main/java/com/squareup/kotlinpoet/AnnotationSpec.kt6
1 files changed, 4 insertions, 2 deletions
diff --git a/kotlinpoet/src/main/java/com/squareup/kotlinpoet/AnnotationSpec.kt b/kotlinpoet/src/main/java/com/squareup/kotlinpoet/AnnotationSpec.kt
index ea496456..7af0a727 100644
--- a/kotlinpoet/src/main/java/com/squareup/kotlinpoet/AnnotationSpec.kt
+++ b/kotlinpoet/src/main/java/com/squareup/kotlinpoet/AnnotationSpec.kt
@@ -152,6 +152,7 @@ public class AnnotationSpec private constructor(
/**
* Annotation value visitor adding members to the given builder instance.
*/
+ @OptIn(DelicateKotlinPoetApi::class)
private class Visitor(
val builder: CodeBlock.Builder
) : SimpleAnnotationValueVisitor7<CodeBlock.Builder, String>(builder) {
@@ -163,10 +164,10 @@ public class AnnotationSpec private constructor(
builder.add("%L", get(a))
override fun visitEnumConstant(c: VariableElement, name: String) =
- builder.add("%T.%L", c.asType(), c.simpleName)
+ builder.add("%T.%L", c.asType().asTypeName(), c.simpleName)
override fun visitType(t: TypeMirror, name: String) =
- builder.add("%T::class", t)
+ builder.add("%T::class", t.asTypeName())
override fun visitArray(values: List<AnnotationValue>, name: String): CodeBlock.Builder {
builder.add("[⇥⇥")
@@ -191,6 +192,7 @@ public class AnnotationSpec private constructor(
includeDefaultValues: Boolean = false
): AnnotationSpec {
try {
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
val javaAnnotation = annotation as java.lang.annotation.Annotation
val builder = builder(javaAnnotation.annotationType())
.tag(annotation)