From a73b9324295fc3397db9e97d2d828ed2470721cd Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Sat, 18 Jan 2020 22:47:56 -0500 Subject: [PATCH] Always emit full types Effectively reverts https://github.com/square/moshi/pull/1041 --- .../squareup/moshi/kotlin/codegen/api/AdapterGenerator.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/api/AdapterGenerator.kt b/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/api/AdapterGenerator.kt index 00214ac..2f93040 100644 --- a/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/api/AdapterGenerator.kt +++ b/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/api/AdapterGenerator.kt @@ -18,7 +18,6 @@ package com.squareup.moshi.kotlin.codegen.api import com.squareup.kotlinpoet.ARRAY import com.squareup.kotlinpoet.AnnotationSpec import com.squareup.kotlinpoet.CodeBlock -import com.squareup.kotlinpoet.CodeBlock.Companion import com.squareup.kotlinpoet.FileSpec import com.squareup.kotlinpoet.FunSpec import com.squareup.kotlinpoet.INT @@ -478,8 +477,10 @@ internal class AdapterGenerator( localConstructorProperty ) } else { - // Standard constructor call. Can omit generics as they're inferred - result.addCode("«%L%T(", returnOrResultAssignment, originalTypeName.rawType()) + // Standard constructor call. Don't omit generics for parameterized types even if they can be + // inferred, as calculating the right condition for inference exceeds the value gained from + // being less pedantic. + result.addCode("«%L%T(", returnOrResultAssignment, originalTypeName) } for (input in components.filterIsInstance()) {