Always emit full types

Effectively reverts https://github.com/square/moshi/pull/1041
This commit is contained in:
Zac Sweers
2020-01-18 22:47:56 -05:00
parent 04f414f600
commit a73b932429

View File

@@ -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<ParameterComponent>()) {