From 9aaef1f6f86c3891be957e185a0cd2efad897bc3 Mon Sep 17 00:00:00 2001 From: Artem Daugel-Dauge Date: Sat, 24 Nov 2018 06:24:19 +0300 Subject: [PATCH] Treat warnings as errors in moshi-kotlin tests (#730) * Fix/supress warnings in tests * Treat kotlinc warnings as errors in tests --- kotlin/tests/pom.xml | 5 +++++ .../squareup/moshi/kotlin/codgen/GeneratedAdaptersTest.kt | 3 ++- .../squareup/moshi/kotlin/reflect/KotlinJsonAdapterTest.kt | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/kotlin/tests/pom.xml b/kotlin/tests/pom.xml index 399dfbb..2b91baf 100644 --- a/kotlin/tests/pom.xml +++ b/kotlin/tests/pom.xml @@ -113,6 +113,11 @@ + + + -Werror + + org.apache.maven.plugins diff --git a/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/codgen/GeneratedAdaptersTest.kt b/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/codgen/GeneratedAdaptersTest.kt index 996ef41..ad16fb2 100644 --- a/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/codgen/GeneratedAdaptersTest.kt +++ b/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/codgen/GeneratedAdaptersTest.kt @@ -35,6 +35,7 @@ import org.junit.Test import java.util.Locale import kotlin.reflect.full.memberProperties +@Suppress("UNUSED", "UNUSED_PARAMETER") class GeneratedAdaptersTest { private val moshi = Moshi.Builder().build() @@ -1037,7 +1038,7 @@ class GeneratedAdaptersTest { @Test fun nullablePrimitivesUseBoxedPrimitiveAdapters() { val moshi = Moshi.Builder() - .add(JsonAdapter.Factory { type, annotations, moshi -> + .add(JsonAdapter.Factory { type, _, _ -> if (Boolean::class.javaObjectType == type) { return@Factory object:JsonAdapter() { override fun fromJson(reader: JsonReader): Boolean? { diff --git a/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/reflect/KotlinJsonAdapterTest.kt b/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/reflect/KotlinJsonAdapterTest.kt index 3339315..0b17f67 100644 --- a/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/reflect/KotlinJsonAdapterTest.kt +++ b/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/reflect/KotlinJsonAdapterTest.kt @@ -34,6 +34,7 @@ import java.util.Locale import java.util.SimpleTimeZone import kotlin.annotation.AnnotationRetention.RUNTIME +@Suppress("UNUSED", "UNUSED_PARAMETER") class KotlinJsonAdapterTest { @Test fun constructorParameters() { val moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build() @@ -918,7 +919,7 @@ class KotlinJsonAdapterTest { @Test fun nullablePrimitivesUseBoxedPrimitiveAdapters() { val moshi = Moshi.Builder() - .add(JsonAdapter.Factory { type, annotations, moshi -> + .add(JsonAdapter.Factory { type, _, _ -> if (Boolean::class.javaObjectType == type) { return@Factory object: JsonAdapter() { override fun fromJson(reader: JsonReader): Boolean? {