From bcb6fd4a4d883e21f7ca88e047f8e0e0bdee9b09 Mon Sep 17 00:00:00 2001 From: Jake Wharton Date: Wed, 10 Apr 2019 10:28:30 -0400 Subject: [PATCH] Don't wrap between throw and exception type --- .../java/com/squareup/moshi/kotlin/codegen/AdapterGenerator.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/AdapterGenerator.kt b/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/AdapterGenerator.kt index 838c5c3..a75740d 100644 --- a/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/AdapterGenerator.kt +++ b/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/AdapterGenerator.kt @@ -308,7 +308,7 @@ internal class AdapterGenerator( .addParameter(valueParam) result.beginControlFlow("if (%N == null)", valueParam) - result.addStatement("throw %T(%S)", NullPointerException::class, + result.addStatement("throw·%T(%S)", NullPointerException::class, "${valueParam.name} was null! Wrap in .nullSafe() to write nullable values.") result.endControlFlow()