From 95549b1d02bd601a8b2b7dd610e9b81cdc9bd869 Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Thu, 16 Nov 2023 14:07:53 -0500 Subject: [PATCH] Another bang --- src/main/kotlin/com/slack/auto/value/kotlin/AvkBuilder.kt | 2 +- .../com/slack/auto/value/kotlin/AutoValueKotlinExtensionTest.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/slack/auto/value/kotlin/AvkBuilder.kt b/src/main/kotlin/com/slack/auto/value/kotlin/AvkBuilder.kt index 26cd74a..a929ff5 100644 --- a/src/main/kotlin/com/slack/auto/value/kotlin/AvkBuilder.kt +++ b/src/main/kotlin/com/slack/auto/value/kotlin/AvkBuilder.kt @@ -206,7 +206,7 @@ public data class AvkBuilder( for (builderProp in builderProps) { if (builderProp.builder != null) { beginControlFlow("if (%N != null)", builderProp.builderPropName) - addStatement("this.%N = %N.build()", builderProp.name, builderProp.builderPropName) + addStatement("this.%N = %N!!.build()", builderProp.name, builderProp.builderPropName) // property builders can never be nullable nextControlFlow("else if (this.%N == null)", builderProp.name) val rawType = diff --git a/src/test/kotlin/com/slack/auto/value/kotlin/AutoValueKotlinExtensionTest.kt b/src/test/kotlin/com/slack/auto/value/kotlin/AutoValueKotlinExtensionTest.kt index 9976aa0..89036a1 100644 --- a/src/test/kotlin/com/slack/auto/value/kotlin/AutoValueKotlinExtensionTest.kt +++ b/src/test/kotlin/com/slack/auto/value/kotlin/AutoValueKotlinExtensionTest.kt @@ -418,7 +418,7 @@ class AutoValueKotlinExtensionTest { internal fun build(): Example { if (requiredBuildableCollectionBuilder != null) { - this.requiredBuildableCollection = requiredBuildableCollectionBuilder.build() + this.requiredBuildableCollection = requiredBuildableCollectionBuilder!!.build() } else if (this.requiredBuildableCollection == null) { this.requiredBuildableCollection = ImmutableList.of() }