mirror of
https://github.com/fankes/moshi.git
synced 2025-10-18 23:49:21 +08:00
Update plugin spotless to v6.14.0 (#1620)
* Update plugin spotless to v6.14.0 * Update Spotless version and apply --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jake Wharton <jw@squareup.com>
This commit is contained in:
@@ -42,7 +42,7 @@ tasks.withType<KotlinCompile>().configureEach {
|
||||
allWarningsAsErrors = useWError
|
||||
@Suppress("SuspiciousCollectionReassignment")
|
||||
freeCompilerArgs += listOf(
|
||||
"-opt-in=kotlin.ExperimentalStdlibApi"
|
||||
"-opt-in=kotlin.ExperimentalStdlibApi",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ tasks.withType<KotlinCompile>().configureEach {
|
||||
allWarningsAsErrors = useWError
|
||||
@Suppress("SuspiciousCollectionReassignment")
|
||||
freeCompilerArgs += listOf(
|
||||
"-opt-in=kotlin.ExperimentalStdlibApi"
|
||||
"-opt-in=kotlin.ExperimentalStdlibApi",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ import kotlin.annotation.AnnotationTarget.TYPE
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class GenericTestClassWithDefaults<T>(
|
||||
val input: String = "",
|
||||
val genericInput: T
|
||||
val genericInput: T,
|
||||
)
|
||||
|
||||
@Target(TYPE)
|
||||
@@ -43,28 +43,29 @@ annotation class TypeAnnotation
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class TypeAnnotationClass(
|
||||
val propertyWithAnnotatedType: @TypeAnnotation String = "",
|
||||
val generic: List<@TypeAnnotation String>
|
||||
val generic: List<@TypeAnnotation String>,
|
||||
)
|
||||
|
||||
// Regression test for https://github.com/square/moshi/issues/1277
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class OtherTestModel(val TestModel: TestModel? = null)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class TestModel(
|
||||
val someVariable: Int,
|
||||
val anotherVariable: String
|
||||
val anotherVariable: String,
|
||||
)
|
||||
|
||||
// Regression test for https://github.com/square/moshi/issues/1022
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class MismatchParentAndNestedClassVisibility(
|
||||
val type: Int,
|
||||
val name: String? = null
|
||||
val name: String? = null,
|
||||
) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class NestedClass(
|
||||
val nestedProperty: String
|
||||
val nestedProperty: String,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -76,13 +77,13 @@ data class KeysWithSpaces(
|
||||
@Json(name = "3. Last Refreshed") val lastRefreshed: String,
|
||||
@Json(name = "4. Interval") val interval: String,
|
||||
@Json(name = "5. Output Size") val size: String,
|
||||
@Json(name = "6. Time Zone") val timeZone: String
|
||||
@Json(name = "6. Time Zone") val timeZone: String,
|
||||
)
|
||||
|
||||
// Regression test for https://github.com/square/moshi/issues/848
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Hotwords(
|
||||
val `class`: List<String>?
|
||||
val `class`: List<String>?,
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -115,7 +116,7 @@ data class SmokeTestType(
|
||||
val aliasedName: TypeAliasName = "Woah",
|
||||
val genericAlias: GenericTypeAlias = listOf("Woah"),
|
||||
// Regression test for https://github.com/square/moshi/issues/1272
|
||||
val nestedArray: Array<Map<String, Any>>? = null
|
||||
val nestedArray: Array<Map<String, Any>>? = null,
|
||||
)
|
||||
|
||||
typealias TypeAliasName = String
|
||||
@@ -132,11 +133,11 @@ enum class Foo { BAR }
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class ClassWithQualifier(
|
||||
@UpperCase(foo = [Foo.BAR])
|
||||
val a: Int
|
||||
val a: Int,
|
||||
)
|
||||
|
||||
// Regression for https://github.com/ZacSweers/MoshiX/issues/120
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class DataClassInModuleB(
|
||||
val id: String
|
||||
val id: String,
|
||||
) : AbstractClassInModuleA()
|
||||
|
@@ -90,7 +90,7 @@ class ComplexGenericsInheritanceTest {
|
||||
data = Person("layer4F")
|
||||
data2 = "layer4F"
|
||||
data3 = "layer4F"
|
||||
}
|
||||
},
|
||||
).apply {
|
||||
layer3C = listOf(1, 2, 3)
|
||||
layer3D = "layer3D"
|
||||
@@ -115,7 +115,7 @@ data class Person(val name: String) : Personable
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class PersonResponse(
|
||||
val extra: String? = null
|
||||
val extra: String? = null,
|
||||
) : ResponseWithSettableProperty<Person, String>()
|
||||
|
||||
abstract class NestedResponse<T : Personable> : ResponseWithSettableProperty<T, String>()
|
||||
@@ -125,7 +125,7 @@ data class NestedPersonResponse(val extra: String? = null) : NestedResponse<Pers
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class UntypedNestedPersonResponse<T : Personable>(
|
||||
val extra: String? = null
|
||||
val extra: String? = null,
|
||||
) : NestedResponse<T>()
|
||||
|
||||
interface LayerInterface<I>
|
||||
@@ -146,5 +146,5 @@ abstract class Layer3<C, D> : Layer2<D>() {
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Layer4<E : Personable, F>(
|
||||
val layer4E: E,
|
||||
val layer4F: F? = null
|
||||
val layer4F: F? = null,
|
||||
) : Layer3<List<Int>, String>(), LayerInterface<String>
|
||||
|
@@ -62,7 +62,7 @@ data class TestClass(
|
||||
val optional2: Int = 2,
|
||||
val dynamicSelfReferenceOptional: String = required,
|
||||
val dynamicOptional: Int = createInt(),
|
||||
val dynamicInlineOptional: Int = createInlineInt()
|
||||
val dynamicInlineOptional: Int = createInlineInt(),
|
||||
)
|
||||
|
||||
private fun createInt(): Int {
|
||||
|
@@ -62,8 +62,8 @@ class GeneratedAdaptersTest {
|
||||
|
||||
assertThat(
|
||||
adapter.toJson(
|
||||
JsonAnnotation("baz")
|
||||
)
|
||||
JsonAnnotation("baz"),
|
||||
),
|
||||
).isEqualTo(expectedJson)
|
||||
}
|
||||
|
||||
@@ -85,8 +85,8 @@ class GeneratedAdaptersTest {
|
||||
|
||||
assertThat(
|
||||
adapter.toJson(
|
||||
JsonAnnotationWithDollarSign("baz")
|
||||
)
|
||||
JsonAnnotationWithDollarSign("baz"),
|
||||
),
|
||||
).isEqualTo(expectedJson)
|
||||
}
|
||||
|
||||
@@ -110,8 +110,8 @@ class GeneratedAdaptersTest {
|
||||
|
||||
assertThat(
|
||||
adapter.toJson(
|
||||
JsonAnnotationWithQuotationMark("baz")
|
||||
)
|
||||
JsonAnnotationWithQuotationMark("baz"),
|
||||
),
|
||||
).isEqualTo(expectedJson)
|
||||
}
|
||||
|
||||
@@ -136,12 +136,13 @@ class GeneratedAdaptersTest {
|
||||
isEmpty()
|
||||
}
|
||||
|
||||
@Language("JSON") val expected =
|
||||
@Language("JSON")
|
||||
val expected =
|
||||
"""{"foo":"fooString","bar":"","bazList":[]}"""
|
||||
assertThat(
|
||||
adapter.toJson(
|
||||
DefaultValues("fooString")
|
||||
)
|
||||
DefaultValues("fooString"),
|
||||
),
|
||||
).isEqualTo(expected)
|
||||
|
||||
// Read/write with real values
|
||||
@@ -164,7 +165,7 @@ class GeneratedAdaptersTest {
|
||||
val foo: String,
|
||||
val bar: String = "",
|
||||
val nullableBar: String? = null,
|
||||
val bazList: List<String> = emptyList()
|
||||
val bazList: List<String> = emptyList(),
|
||||
)
|
||||
|
||||
@Test
|
||||
@@ -206,6 +207,7 @@ class GeneratedAdaptersTest {
|
||||
@Language("JSON")
|
||||
val json =
|
||||
"""{"foo":"foo","nullableString":null}"""
|
||||
|
||||
@Language("JSON")
|
||||
val invalidJson =
|
||||
"""{"foo":null,"nullableString":null}"""
|
||||
@@ -225,7 +227,7 @@ class GeneratedAdaptersTest {
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class NullabeTypes(
|
||||
val foo: String,
|
||||
val nullableString: String?
|
||||
val nullableString: String?,
|
||||
)
|
||||
|
||||
@Test
|
||||
@@ -238,7 +240,7 @@ class GeneratedAdaptersTest {
|
||||
mutableMapOf(),
|
||||
emptyList(),
|
||||
emptySet(),
|
||||
emptyMap()
|
||||
emptyMap(),
|
||||
)
|
||||
|
||||
val json = adapter.toJson(specialCollections)
|
||||
@@ -253,7 +255,7 @@ class GeneratedAdaptersTest {
|
||||
val mutableMap: MutableMap<String, String>,
|
||||
val immutableList: List<String>,
|
||||
val immutableSet: Set<String>,
|
||||
val immutableMap: Map<String, String>
|
||||
val immutableMap: Map<String, String>,
|
||||
)
|
||||
|
||||
@Test
|
||||
@@ -272,7 +274,7 @@ class GeneratedAdaptersTest {
|
||||
mutableListOf("immutableMutableList"),
|
||||
mutableListOf("immutableImmutableList"),
|
||||
mutableListOf("mutableMutableList"),
|
||||
mutableListOf("mutableImmutableList")
|
||||
mutableListOf("mutableImmutableList"),
|
||||
)
|
||||
|
||||
val json = adapter.toJson(mutableProperties)
|
||||
@@ -293,7 +295,7 @@ class GeneratedAdaptersTest {
|
||||
val nullableImmutableMutableList: MutableList<String>?,
|
||||
val nullableImmutableImmutableList: List<String>?,
|
||||
var nullableMutableMutableList: MutableList<String>?,
|
||||
var nullableMutableImmutableList: List<String>
|
||||
var nullableMutableImmutableList: List<String>,
|
||||
)
|
||||
|
||||
@Test
|
||||
@@ -306,7 +308,7 @@ class GeneratedAdaptersTest {
|
||||
setOf("foo", null, "bar"),
|
||||
mapOf("foo" to "bar", "baz" to null),
|
||||
null,
|
||||
1
|
||||
1,
|
||||
)
|
||||
|
||||
val noNullsTypeParams = NullableTypeParams(
|
||||
@@ -314,7 +316,7 @@ class GeneratedAdaptersTest {
|
||||
nullableTypeParams.nullableSet,
|
||||
nullableTypeParams.nullableMap.filterValues { it != null },
|
||||
null,
|
||||
1
|
||||
1,
|
||||
)
|
||||
|
||||
val json = adapter.toJson(nullableTypeParams)
|
||||
@@ -332,7 +334,7 @@ class GeneratedAdaptersTest {
|
||||
val nullableSet: Set<String?>,
|
||||
val nullableMap: Map<String, String?>,
|
||||
val nullableT: T?,
|
||||
val nonNullT: T
|
||||
val nonNullT: T,
|
||||
)
|
||||
|
||||
@Test fun doNotGenerateAdapter() {
|
||||
@@ -352,7 +354,7 @@ class GeneratedAdaptersTest {
|
||||
|
||||
val encoded = ConstructorParameters(
|
||||
3,
|
||||
5
|
||||
5,
|
||||
)
|
||||
assertThat(jsonAdapter.toJson(encoded)).isEqualTo("""{"a":3,"b":5}""")
|
||||
|
||||
@@ -389,7 +391,7 @@ class GeneratedAdaptersTest {
|
||||
val jsonAdapter = moshi.adapter<ConstructorParametersAndProperties>()
|
||||
|
||||
val encoded = ConstructorParametersAndProperties(
|
||||
3
|
||||
3,
|
||||
)
|
||||
encoded.b = 5
|
||||
assertThat(jsonAdapter.toJson(encoded)).isEqualTo("""{"a":3,"b":5}""")
|
||||
@@ -410,7 +412,7 @@ class GeneratedAdaptersTest {
|
||||
|
||||
val encoded = ImmutableConstructorParameters(
|
||||
3,
|
||||
5
|
||||
5,
|
||||
)
|
||||
assertThat(jsonAdapter.toJson(encoded)).isEqualTo("""{"a":3,"b":5}""")
|
||||
|
||||
@@ -446,7 +448,7 @@ class GeneratedAdaptersTest {
|
||||
|
||||
val encoded = ConstructorDefaultValues(
|
||||
3,
|
||||
5
|
||||
5,
|
||||
)
|
||||
assertThat(jsonAdapter.toJson(encoded)).isEqualTo("""{"a":3,"b":5}""")
|
||||
|
||||
@@ -498,7 +500,7 @@ class GeneratedAdaptersTest {
|
||||
|
||||
val encoded = ConstructorParameterWithQualifier(
|
||||
"Android",
|
||||
"Banana"
|
||||
"Banana",
|
||||
)
|
||||
assertThat(jsonAdapter.toJson(encoded)).isEqualTo("""{"a":"ANDROID","b":"Banana"}""")
|
||||
|
||||
@@ -544,7 +546,8 @@ class GeneratedAdaptersTest {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
class PropertyWithQualifier {
|
||||
@Uppercase(inFrench = true) var a: String = ""
|
||||
@Uppercase(inFrench = true)
|
||||
var a: String = ""
|
||||
var b: String = ""
|
||||
}
|
||||
|
||||
@@ -554,7 +557,7 @@ class GeneratedAdaptersTest {
|
||||
|
||||
val encoded = ConstructorParameterWithJsonName(
|
||||
3,
|
||||
5
|
||||
5,
|
||||
)
|
||||
assertThat(jsonAdapter.toJson(encoded)).isEqualTo("""{"key a":3,"b":5}""")
|
||||
|
||||
@@ -582,7 +585,8 @@ class GeneratedAdaptersTest {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
class PropertyWithJsonName {
|
||||
@Json(name = "key a") var a: Int = -1
|
||||
@Json(name = "key a")
|
||||
var a: Int = -1
|
||||
var b: Int = -1
|
||||
}
|
||||
|
||||
@@ -592,7 +596,7 @@ class GeneratedAdaptersTest {
|
||||
|
||||
val encoded = TransientConstructorParameter(
|
||||
3,
|
||||
5
|
||||
5,
|
||||
)
|
||||
assertThat(jsonAdapter.toJson(encoded)).isEqualTo("""{"b":5}""")
|
||||
|
||||
@@ -639,6 +643,7 @@ class GeneratedAdaptersTest {
|
||||
@JsonClass(generateAdapter = true)
|
||||
class TransientProperty {
|
||||
@Transient var a: Int = -1
|
||||
|
||||
@Transient private var b: Int = -1
|
||||
var c: Int = -1
|
||||
|
||||
@@ -670,11 +675,13 @@ class GeneratedAdaptersTest {
|
||||
private fun <T> delegate(initial: T) = Delegates.observable(initial) { _, _, _ -> }
|
||||
|
||||
@delegate:Transient var a: Int by delegate(-1)
|
||||
|
||||
@delegate:Transient private var b: Int by delegate(-1)
|
||||
var c: Int by delegate(-1)
|
||||
|
||||
@JvmName("getBPublic")
|
||||
fun getB() = b
|
||||
|
||||
@JvmName("setBPublic")
|
||||
fun setB(b: Int) {
|
||||
this.b = b
|
||||
@@ -692,7 +699,7 @@ class GeneratedAdaptersTest {
|
||||
116, 117, 118, 119, 120,
|
||||
121, 122, 123, 124, 125,
|
||||
126, 127, 128, 129, 130,
|
||||
131, 132
|
||||
131, 132,
|
||||
)
|
||||
val json = (
|
||||
"""
|
||||
@@ -748,7 +755,7 @@ class GeneratedAdaptersTest {
|
||||
var v29: Int,
|
||||
var v30: Int,
|
||||
var v31: Int,
|
||||
var v32: Int
|
||||
var v32: Int,
|
||||
)
|
||||
|
||||
@Test fun manyProperties33() {
|
||||
@@ -762,7 +769,7 @@ class GeneratedAdaptersTest {
|
||||
116, 117, 118, 119, 120,
|
||||
121, 122, 123, 124, 125,
|
||||
126, 127, 128, 129, 130,
|
||||
131, 132, 133
|
||||
131, 132, 133,
|
||||
)
|
||||
val json = (
|
||||
"""
|
||||
@@ -820,7 +827,7 @@ class GeneratedAdaptersTest {
|
||||
var v30: Int,
|
||||
var v31: Int,
|
||||
var v32: Int,
|
||||
var v33: Int
|
||||
var v33: Int,
|
||||
)
|
||||
|
||||
@Test fun unsettablePropertyIgnored() {
|
||||
@@ -896,7 +903,7 @@ class GeneratedAdaptersTest {
|
||||
|
||||
val encoded = SubtypeConstructorParameters(
|
||||
3,
|
||||
5
|
||||
5,
|
||||
)
|
||||
assertThat(jsonAdapter.toJson(encoded)).isEqualTo("""{"a":3,"b":5}""")
|
||||
|
||||
@@ -934,7 +941,8 @@ class GeneratedAdaptersTest {
|
||||
}
|
||||
|
||||
/** Generated adapters don't track enough state to detect duplicated values. */
|
||||
@Ignore @Test fun duplicatedValueParameter() {
|
||||
@Ignore @Test
|
||||
fun duplicatedValueParameter() {
|
||||
val moshi = Moshi.Builder().build()
|
||||
val jsonAdapter = moshi.adapter<DuplicateValueParameter>()
|
||||
|
||||
@@ -949,7 +957,8 @@ class GeneratedAdaptersTest {
|
||||
class DuplicateValueParameter(var a: Int = -1, var b: Int = -2)
|
||||
|
||||
/** Generated adapters don't track enough state to detect duplicated values. */
|
||||
@Ignore @Test fun duplicatedValueProperty() {
|
||||
@Ignore @Test
|
||||
fun duplicatedValueProperty() {
|
||||
val moshi = Moshi.Builder().build()
|
||||
val jsonAdapter = moshi.adapter<DuplicateValueProperty>()
|
||||
|
||||
@@ -997,7 +1006,7 @@ class GeneratedAdaptersTest {
|
||||
|
||||
val encoded = MultiplePropertiesShareAdapter(
|
||||
"Android",
|
||||
"Banana"
|
||||
"Banana",
|
||||
)
|
||||
assertThat(jsonAdapter.toJson(encoded)).isEqualTo("""{"a":"ANDROID","b":"BANANA"}""")
|
||||
|
||||
@@ -1011,7 +1020,7 @@ class GeneratedAdaptersTest {
|
||||
@JsonClass(generateAdapter = true)
|
||||
class MultiplePropertiesShareAdapter(
|
||||
@Uppercase(true) var a: String,
|
||||
@Uppercase(true) var b: String
|
||||
@Uppercase(true) var b: String,
|
||||
)
|
||||
|
||||
@Test fun toJsonOnly() {
|
||||
@@ -1022,8 +1031,8 @@ class GeneratedAdaptersTest {
|
||||
|
||||
assertThat(
|
||||
jsonAdapter.toJson(
|
||||
CustomToJsonOnly(1, 2)
|
||||
)
|
||||
CustomToJsonOnly(1, 2),
|
||||
),
|
||||
).isEqualTo("""[1,2]""")
|
||||
|
||||
val fromJson = jsonAdapter.fromJson("""{"a":3,"b":4}""")!!
|
||||
@@ -1048,8 +1057,8 @@ class GeneratedAdaptersTest {
|
||||
|
||||
assertThat(
|
||||
jsonAdapter.toJson(
|
||||
CustomFromJsonOnly(1, 2)
|
||||
)
|
||||
CustomFromJsonOnly(1, 2),
|
||||
),
|
||||
).isEqualTo("""{"a":1,"b":2}""")
|
||||
|
||||
val fromJson = jsonAdapter.fromJson("""[3,4]""")!!
|
||||
@@ -1131,9 +1140,9 @@ class GeneratedAdaptersTest {
|
||||
assertThat(
|
||||
jsonAdapter.toJson(
|
||||
HasParameterizedProperty(
|
||||
Twins("1", "2")
|
||||
)
|
||||
)
|
||||
Twins("1", "2"),
|
||||
),
|
||||
),
|
||||
)
|
||||
.isEqualTo("""{"twins":{"a":"1","b":"2"}}""")
|
||||
|
||||
@@ -1157,8 +1166,8 @@ class GeneratedAdaptersTest {
|
||||
|
||||
assertThat(
|
||||
adapter.toJson(
|
||||
UppercasePropertyName(3, 4)
|
||||
)
|
||||
UppercasePropertyName(3, 4),
|
||||
),
|
||||
).isEqualTo("""{"AAA":3,"BBB":4}""")
|
||||
}
|
||||
|
||||
@@ -1193,6 +1202,7 @@ class GeneratedAdaptersTest {
|
||||
fun toJson(@Uppercase(inFrench = true) s: String): String {
|
||||
return s.uppercase(Locale.US)
|
||||
}
|
||||
|
||||
@FromJson
|
||||
@Uppercase(inFrench = true)
|
||||
fun fromJson(s: String): String {
|
||||
@@ -1223,7 +1233,7 @@ class GeneratedAdaptersTest {
|
||||
}
|
||||
}
|
||||
null
|
||||
}
|
||||
},
|
||||
)
|
||||
.build()
|
||||
val adapter = moshi.adapter<HasNullableBoolean>().serializeNulls()
|
||||
@@ -1231,8 +1241,8 @@ class GeneratedAdaptersTest {
|
||||
.isEqualTo(HasNullableBoolean(null))
|
||||
assertThat(
|
||||
adapter.toJson(
|
||||
HasNullableBoolean(null)
|
||||
)
|
||||
HasNullableBoolean(null),
|
||||
),
|
||||
).isEqualTo("""{"boolean":null}""")
|
||||
}
|
||||
|
||||
@@ -1251,15 +1261,15 @@ class GeneratedAdaptersTest {
|
||||
val adapter = moshi.adapter<HasCollectionOfPrimitives>()
|
||||
|
||||
val encoded = HasCollectionOfPrimitives(
|
||||
listOf(1, 2, -3)
|
||||
listOf(1, 2, -3),
|
||||
)
|
||||
assertThat(adapter.toJson(encoded)).isEqualTo("""{"listOfInts":[1,2,-3]}""")
|
||||
|
||||
val decoded = adapter.fromJson("""{"listOfInts":[4,-5,6]}""")!!
|
||||
assertThat(decoded).isEqualTo(
|
||||
HasCollectionOfPrimitives(
|
||||
listOf(4, -5, 6)
|
||||
)
|
||||
listOf(4, -5, 6),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1271,7 +1281,7 @@ class GeneratedAdaptersTest {
|
||||
val adapter = moshi.adapter<CustomGeneratedClass>()
|
||||
val unwrapped = (adapter as NullSafeJsonAdapter<CustomGeneratedClass>).delegate
|
||||
assertThat(unwrapped).isInstanceOf(
|
||||
GeneratedAdaptersTest_CustomGeneratedClassJsonAdapter::class.java
|
||||
GeneratedAdaptersTest_CustomGeneratedClassJsonAdapter::class.java,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1313,9 +1323,10 @@ class GeneratedAdaptersTest {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class ClassWithFieldJson(
|
||||
@field:Json(name = "_links") val links: String
|
||||
@field:Json(name = "_links") val links: String,
|
||||
) {
|
||||
@field:Json(name = "_ids") var ids: String? = null
|
||||
@field:Json(name = "_ids")
|
||||
var ids: String? = null
|
||||
}
|
||||
|
||||
// Regression test to ensure annotations with field site targets still use the right name
|
||||
@@ -1357,7 +1368,7 @@ class GeneratedAdaptersTest {
|
||||
try {
|
||||
GeneratedAdaptersTest_MultipleGenericsJsonAdapter<String, Any, Any, Any>(
|
||||
moshi,
|
||||
arrayOf(String::class.java)
|
||||
arrayOf(String::class.java),
|
||||
)
|
||||
fail("Should have failed to construct the adapter due to wrong number of generics")
|
||||
} catch (e: IllegalArgumentException) {
|
||||
@@ -1396,5 +1407,5 @@ data class NullableTypeParams<T>(
|
||||
val nullableSet: Set<String?>,
|
||||
val nullableMap: Map<String, String?>,
|
||||
val nullableT: T?,
|
||||
val nonNullT: T
|
||||
val nonNullT: T,
|
||||
)
|
||||
|
@@ -13,6 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
@file:Suppress("PackageName")
|
||||
|
||||
package com.squareup.moshi.kotlin.codegen.LooksLikeAClass
|
||||
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
@@ -35,7 +35,7 @@ class MixingReflectAndCodeGen {
|
||||
assertThat(reflectionAdapter.toString())
|
||||
.isEqualTo(
|
||||
"KotlinJsonAdapter(com.squareup.moshi.kotlin.codegen.MixingReflectAndCodeGen" +
|
||||
".UsesReflectionAdapter).nullSafe()"
|
||||
".UsesReflectionAdapter).nullSafe()",
|
||||
)
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,6 @@ import org.junit.Test
|
||||
*/
|
||||
class MultipleMasksTest {
|
||||
@Test fun testMultipleMasks() {
|
||||
|
||||
// Set some arbitrary values to make sure offsets are aligning correctly
|
||||
@Language("JSON")
|
||||
val json =
|
||||
@@ -121,5 +120,5 @@ class MultipleMasks(
|
||||
val arg62: Long = 62,
|
||||
val arg63: Long = 63,
|
||||
val arg64: Long = 64,
|
||||
val arg65: Long = 65
|
||||
val arg65: Long = 65,
|
||||
)
|
||||
|
@@ -28,6 +28,7 @@ class UppercaseInAnnotationPackageJsonAdapter {
|
||||
fun toJson(@UppercaseInAnnotationPackage s: String): String {
|
||||
return s.uppercase(Locale.US)
|
||||
}
|
||||
|
||||
@FromJson
|
||||
@UppercaseInAnnotationPackage
|
||||
fun fromJson(s: String): String {
|
||||
|
@@ -20,9 +20,14 @@ import com.squareup.moshi.Json
|
||||
public abstract class AbstractClassInModuleA {
|
||||
// Ignored/transient to ensure processor sees them across module boundaries.
|
||||
@Transient private lateinit var lateinitTransient: String
|
||||
|
||||
@Transient private var regularTransient: String = "regularTransient"
|
||||
|
||||
// Note that we target the field because otherwise it is stored on the synthetic holder method for
|
||||
// annotations, which isn't visible from kapt
|
||||
@field:Json(ignore = true) private lateinit var lateinitIgnored: String
|
||||
@field:Json(ignore = true) private var regularIgnored: String = "regularIgnored"
|
||||
@field:Json(ignore = true)
|
||||
private lateinit var lateinitIgnored: String
|
||||
|
||||
@field:Json(ignore = true)
|
||||
private var regularIgnored: String = "regularIgnored"
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ class DualKotlinTest {
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
@FromJson
|
||||
fun fromJson(string: String): String? = null
|
||||
}
|
||||
},
|
||||
)
|
||||
.build()
|
||||
.adapter<HasNonNullProperty>()
|
||||
@@ -125,7 +125,7 @@ class DualKotlinTest {
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
@FromJson
|
||||
fun fromJson(string: String): String? = null
|
||||
}
|
||||
},
|
||||
)
|
||||
.build()
|
||||
.adapter<HasNonNullPropertyDifferentJsonName>()
|
||||
@@ -141,7 +141,8 @@ class DualKotlinTest {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
class HasNonNullPropertyDifferentJsonName {
|
||||
@Json(name = "aPrime") var a: String = ""
|
||||
@Json(name = "aPrime")
|
||||
var a: String = ""
|
||||
}
|
||||
|
||||
@Test fun nonNullConstructorParameterCalledWithNullFailsWithJsonDataException() {
|
||||
@@ -163,7 +164,7 @@ class DualKotlinTest {
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
@FromJson
|
||||
fun fromJson(string: String): String? = null
|
||||
}
|
||||
},
|
||||
)
|
||||
.build()
|
||||
.adapter<HasNonNullConstructorParameter>()
|
||||
@@ -199,7 +200,7 @@ class DualKotlinTest {
|
||||
fun toJson(@Nullable value: String?): String {
|
||||
return value ?: "fallback"
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
.build()
|
||||
|
||||
@@ -208,7 +209,7 @@ class DualKotlinTest {
|
||||
assertThat(
|
||||
//language=JSON
|
||||
hasNonNullConstructorParameterAdapter
|
||||
.fromJson("{\"a\":null}")
|
||||
.fromJson("{\"a\":null}"),
|
||||
).isEqualTo(HasNonNullConstructorParameter("fallback"))
|
||||
|
||||
val hasNullableConstructorParameterAdapter =
|
||||
@@ -216,12 +217,12 @@ class DualKotlinTest {
|
||||
assertThat(
|
||||
//language=JSON
|
||||
hasNullableConstructorParameterAdapter
|
||||
.fromJson("{\"a\":null}")
|
||||
.fromJson("{\"a\":null}"),
|
||||
).isEqualTo(HasNullableConstructorParameter("fallback"))
|
||||
//language=JSON
|
||||
assertThat(
|
||||
hasNullableConstructorParameterAdapter
|
||||
.toJson(HasNullableConstructorParameter(null))
|
||||
.toJson(HasNullableConstructorParameter(null)),
|
||||
).isEqualTo("{\"a\":\"fallback\"}")
|
||||
}
|
||||
|
||||
@@ -329,7 +330,7 @@ class DualKotlinTest {
|
||||
.isEqualTo(
|
||||
"""
|
||||
{"text":"root","r":{"number":0,"r":{"text":"grand child 1"},"t":{"number":1}},"t":{"text":"child 1"}}
|
||||
""".trimIndent()
|
||||
""".trimIndent(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -418,7 +419,7 @@ class DualKotlinTest {
|
||||
class MultipleNonPropertyParameters(
|
||||
val prop: Int,
|
||||
param1: Int = 1,
|
||||
param2: Int = 2
|
||||
param2: Int = 2,
|
||||
) {
|
||||
init {
|
||||
// Ensure the params always uses their default value
|
||||
@@ -445,7 +446,7 @@ class DualKotlinTest {
|
||||
@JsonClass(generateAdapter = true)
|
||||
class OnlyMultipleNonPropertyParameters(
|
||||
param1: Int = 1,
|
||||
param2: Int = 2
|
||||
param2: Int = 2,
|
||||
) {
|
||||
init {
|
||||
// Ensure the params always uses their default value
|
||||
@@ -472,7 +473,7 @@ class DualKotlinTest {
|
||||
parameterized = GenericClass(6),
|
||||
wildcardIn = GenericClass(6),
|
||||
wildcardOut = GenericClass(6),
|
||||
complex = GenericClass(listOf(GenericClass(6)))
|
||||
complex = GenericClass(listOf(GenericClass(6))),
|
||||
)
|
||||
assertThat(adapter.toJson(testValue)).isEqualTo(testJson)
|
||||
|
||||
@@ -486,7 +487,7 @@ class DualKotlinTest {
|
||||
val parameterized: GenericClass<TypeAlias>,
|
||||
val wildcardIn: GenericClass<in TypeAlias>,
|
||||
val wildcardOut: GenericClass<out TypeAlias>,
|
||||
val complex: GenericClass<GenericTypeAlias>?
|
||||
val complex: GenericClass<GenericTypeAlias>?,
|
||||
)
|
||||
|
||||
// Regression test for https://github.com/square/moshi/issues/991
|
||||
@@ -506,7 +507,7 @@ class DualKotlinTest {
|
||||
int = 3,
|
||||
long = 3,
|
||||
float = 3.2f,
|
||||
double = 3.2
|
||||
double = 3.2,
|
||||
)
|
||||
assertThat(adapter.toJson(instance))
|
||||
.isEqualTo(testJson)
|
||||
@@ -533,7 +534,7 @@ class DualKotlinTest {
|
||||
val float: Float,
|
||||
val nullableFloat: Float? = null,
|
||||
val double: Double,
|
||||
val nullableDouble: Double? = null
|
||||
val nullableDouble: Double? = null,
|
||||
)
|
||||
|
||||
// Regression test for https://github.com/square/moshi/issues/990
|
||||
@@ -577,7 +578,7 @@ class DualKotlinTest {
|
||||
val redundantNullableAShouldBeNullable: NullableA?,
|
||||
val manuallyNullableAShouldBeNullable: A?,
|
||||
val convolutedMultiNullableShouldBeNullable: NullableB?,
|
||||
val deepNestedNullableShouldBeNullable: E
|
||||
val deepNestedNullableShouldBeNullable: E,
|
||||
)
|
||||
|
||||
// Regression test for https://github.com/square/moshi/issues/1009
|
||||
@@ -617,12 +618,12 @@ class DualKotlinTest {
|
||||
interface IntersectionTypeInterface<E : Enum<E>>
|
||||
|
||||
enum class IntersectionTypesEnum : IntersectionTypeInterface<IntersectionTypesEnum> {
|
||||
VALUE
|
||||
VALUE,
|
||||
}
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class IntersectionTypes<E>(
|
||||
val value: E
|
||||
val value: E,
|
||||
) where E : Enum<E>, E : IntersectionTypeInterface<E>
|
||||
|
||||
@Test fun transientConstructorParameter() {
|
||||
@@ -672,6 +673,7 @@ class DualKotlinTest {
|
||||
|
||||
class TransientProperty {
|
||||
@Transient var a: Int = -1
|
||||
|
||||
@Transient private var b: Int = -1
|
||||
var c: Int = -1
|
||||
|
||||
@@ -712,7 +714,7 @@ class DualKotlinTest {
|
||||
class MultipleIgnoredConstructorParameters(
|
||||
@Json(ignore = true) var a: Int = -1,
|
||||
var b: Int = -1,
|
||||
@Json(ignore = true) var c: Int = -1
|
||||
@Json(ignore = true) var c: Int = -1,
|
||||
)
|
||||
|
||||
@Test fun ignoredProperty() {
|
||||
@@ -732,8 +734,11 @@ class DualKotlinTest {
|
||||
}
|
||||
|
||||
class IgnoredProperty {
|
||||
@Json(ignore = true) var a: Int = -1
|
||||
@Json(ignore = true) private var b: Int = -1
|
||||
@Json(ignore = true)
|
||||
var a: Int = -1
|
||||
|
||||
@Json(ignore = true)
|
||||
private var b: Int = -1
|
||||
var c: Int = -1
|
||||
|
||||
fun getB() = b
|
||||
@@ -756,11 +761,12 @@ class DualKotlinTest {
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class PropertyWithDollarSign(
|
||||
val `$a`: String,
|
||||
@Json(name = "\$b") val b: String
|
||||
@Json(name = "\$b") val b: String,
|
||||
)
|
||||
}
|
||||
|
||||
typealias TypeAlias = Int
|
||||
|
||||
@Suppress("REDUNDANT_PROJECTION")
|
||||
typealias GenericTypeAlias = List<out GenericClass<in TypeAlias>?>?
|
||||
|
||||
|
@@ -276,7 +276,8 @@ class KotlinJsonAdapterTest {
|
||||
}
|
||||
|
||||
class PropertyWithJsonName {
|
||||
@Json(name = "key a") var a: Int = -1
|
||||
@Json(name = "key a")
|
||||
var a: Int = -1
|
||||
var b: Int = -1
|
||||
}
|
||||
|
||||
@@ -289,7 +290,7 @@ class KotlinJsonAdapterTest {
|
||||
assertThat(expected).hasMessageThat().isEqualTo(
|
||||
"No default value for transient constructor parameter #0 " +
|
||||
"a of fun `<init>`(kotlin.Int): " +
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest.RequiredTransientConstructorParameter"
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest.RequiredTransientConstructorParameter",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -305,7 +306,7 @@ class KotlinJsonAdapterTest {
|
||||
assertThat(expected).hasMessageThat().isEqualTo(
|
||||
"No default value for ignored constructor parameter #0 " +
|
||||
"a of fun `<init>`(kotlin.Int): " +
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest.RequiredIgnoredConstructorParameter"
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest.RequiredIgnoredConstructorParameter",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -320,7 +321,7 @@ class KotlinJsonAdapterTest {
|
||||
} catch (expected: IllegalArgumentException) {
|
||||
assertThat(expected).hasMessageThat().isEqualTo(
|
||||
"'a' has a constructor parameter of type " +
|
||||
"kotlin.Int but a property of type kotlin.String."
|
||||
"kotlin.Int but a property of type kotlin.String.",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -406,7 +407,7 @@ class KotlinJsonAdapterTest {
|
||||
fail()
|
||||
} catch (e: IllegalArgumentException) {
|
||||
assertThat(e).hasMessageThat().isEqualTo(
|
||||
"Platform class kotlin.Triple in kotlin.Triple<?, ?, ?> requires explicit JsonAdapter to be registered"
|
||||
"Platform class kotlin.Triple in kotlin.Triple<?, ?, ?> requires explicit JsonAdapter to be registered",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -551,7 +552,7 @@ class KotlinJsonAdapterTest {
|
||||
} catch (expected: IllegalArgumentException) {
|
||||
assertThat(expected).hasMessageThat().isEqualTo(
|
||||
"No property for required constructor parameter #0 a of fun `<init>`(" +
|
||||
"kotlin.Int, kotlin.Int): ${NonPropertyConstructorParameter::class.qualifiedName}"
|
||||
"kotlin.Int, kotlin.Int): ${NonPropertyConstructorParameter::class.qualifiedName}",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -579,7 +580,7 @@ class KotlinJsonAdapterTest {
|
||||
} catch (e: IllegalArgumentException) {
|
||||
assertThat(e).hasMessageThat().isEqualTo(
|
||||
"No JsonAdapter for interface " +
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$Interface (with no annotations)"
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$Interface (with no annotations)",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -594,7 +595,7 @@ class KotlinJsonAdapterTest {
|
||||
} catch (e: IllegalArgumentException) {
|
||||
assertThat(e).hasMessageThat().isEqualTo(
|
||||
"Cannot serialize abstract class " +
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$AbstractClass"
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$AbstractClass",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -609,7 +610,7 @@ class KotlinJsonAdapterTest {
|
||||
} catch (e: IllegalArgumentException) {
|
||||
assertThat(e).hasMessageThat().isEqualTo(
|
||||
"Cannot serialize inner class " +
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$InnerClass"
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$InnerClass",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -625,7 +626,7 @@ class KotlinJsonAdapterTest {
|
||||
} catch (e: IllegalArgumentException) {
|
||||
assertThat(e).hasMessageThat().isEqualTo(
|
||||
"Cannot serialize local class or object expression " +
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$localClassesNotSupported\$LocalClass"
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$localClassesNotSupported\$LocalClass",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -638,7 +639,7 @@ class KotlinJsonAdapterTest {
|
||||
} catch (e: IllegalArgumentException) {
|
||||
assertThat(e).hasMessageThat().isEqualTo(
|
||||
"Cannot serialize object declaration " +
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$ObjectDeclaration"
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$ObjectDeclaration",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -666,7 +667,7 @@ class KotlinJsonAdapterTest {
|
||||
assertThat(e).hasMessageThat().isEqualTo(
|
||||
"Cannot serialize $type " +
|
||||
"com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterTest\$anonymousClassesNotSupported" +
|
||||
"\$expression$1"
|
||||
"\$expression$1",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -682,7 +683,7 @@ class KotlinJsonAdapterTest {
|
||||
116, 117, 118, 119, 120,
|
||||
121, 122, 123, 124, 125,
|
||||
126, 127, 128, 129, 130,
|
||||
131, 132
|
||||
131, 132,
|
||||
)
|
||||
val json = (
|
||||
"""
|
||||
@@ -737,7 +738,7 @@ class KotlinJsonAdapterTest {
|
||||
var v29: Int,
|
||||
var v30: Int,
|
||||
var v31: Int,
|
||||
var v32: Int
|
||||
var v32: Int,
|
||||
)
|
||||
|
||||
@Test fun manyProperties33() {
|
||||
@@ -751,7 +752,7 @@ class KotlinJsonAdapterTest {
|
||||
116, 117, 118, 119, 120,
|
||||
121, 122, 123, 124, 125,
|
||||
126, 127, 128, 129, 130,
|
||||
131, 132, 133
|
||||
131, 132, 133,
|
||||
)
|
||||
val json = (
|
||||
"""
|
||||
@@ -808,7 +809,7 @@ class KotlinJsonAdapterTest {
|
||||
var v30: Int,
|
||||
var v31: Int,
|
||||
var v32: Int,
|
||||
var v33: Int
|
||||
var v33: Int,
|
||||
)
|
||||
|
||||
data class Box<out T>(val data: T)
|
||||
@@ -856,6 +857,7 @@ class KotlinJsonAdapterTest {
|
||||
fun toJson(@Uppercase s: String): String {
|
||||
return s.uppercase(Locale.US)
|
||||
}
|
||||
|
||||
@FromJson
|
||||
@Uppercase
|
||||
fun fromJson(s: String): String {
|
||||
@@ -885,7 +887,7 @@ class KotlinJsonAdapterTest {
|
||||
}
|
||||
}
|
||||
null
|
||||
}
|
||||
},
|
||||
)
|
||||
.add(KotlinJsonAdapterFactory())
|
||||
.build()
|
||||
@@ -922,7 +924,7 @@ class KotlinJsonAdapterTest {
|
||||
mapWildcardsParameterizedTest(
|
||||
MapOfStringToStandardReflection::class.java,
|
||||
"""{"map":{"key":"value"}}""",
|
||||
MapOfStringToStandardReflection(mapOf("key" to "value"))
|
||||
MapOfStringToStandardReflection(mapOf("key" to "value")),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -933,7 +935,7 @@ class KotlinJsonAdapterTest {
|
||||
mapWildcardsParameterizedTest(
|
||||
MapOfStringToStandardCodegen::class.java,
|
||||
"""{"map":{"key":"value"}}""",
|
||||
MapOfStringToStandardCodegen(mapOf("key" to "value"))
|
||||
MapOfStringToStandardCodegen(mapOf("key" to "value")),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -945,7 +947,7 @@ class KotlinJsonAdapterTest {
|
||||
mapWildcardsParameterizedTest(
|
||||
MapOfStringToEnumReflection::class.java,
|
||||
"""{"map":{"key":"A"}}""",
|
||||
MapOfStringToEnumReflection(mapOf("key" to KotlinEnum.A))
|
||||
MapOfStringToEnumReflection(mapOf("key" to KotlinEnum.A)),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -956,7 +958,7 @@ class KotlinJsonAdapterTest {
|
||||
mapWildcardsParameterizedTest(
|
||||
MapOfStringToEnumCodegen::class.java,
|
||||
"""{"map":{"key":"A"}}""",
|
||||
MapOfStringToEnumCodegen(mapOf("key" to KotlinEnum.A))
|
||||
MapOfStringToEnumCodegen(mapOf("key" to KotlinEnum.A)),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -968,7 +970,7 @@ class KotlinJsonAdapterTest {
|
||||
mapWildcardsParameterizedTest(
|
||||
MapOfStringToCollectionReflection::class.java,
|
||||
"""{"map":{"key":[]}}""",
|
||||
MapOfStringToCollectionReflection(mapOf("key" to listOf()))
|
||||
MapOfStringToCollectionReflection(mapOf("key" to listOf())),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -979,7 +981,7 @@ class KotlinJsonAdapterTest {
|
||||
mapWildcardsParameterizedTest(
|
||||
MapOfStringToCollectionCodegen::class.java,
|
||||
"""{"map":{"key":[]}}""",
|
||||
MapOfStringToCollectionCodegen(mapOf("key" to listOf()))
|
||||
MapOfStringToCollectionCodegen(mapOf("key" to listOf())),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -991,7 +993,7 @@ class KotlinJsonAdapterTest {
|
||||
mapWildcardsParameterizedTest(
|
||||
MapOfStringToMapReflection::class.java,
|
||||
"""{"map":{"key":{}}}""",
|
||||
MapOfStringToMapReflection(mapOf("key" to mapOf()))
|
||||
MapOfStringToMapReflection(mapOf("key" to mapOf())),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1002,7 +1004,7 @@ class KotlinJsonAdapterTest {
|
||||
mapWildcardsParameterizedTest(
|
||||
MapOfStringToMapCodegen::class.java,
|
||||
"""{"map":{"key":{}}}""",
|
||||
MapOfStringToMapCodegen(mapOf("key" to mapOf()))
|
||||
MapOfStringToMapCodegen(mapOf("key" to mapOf())),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1014,7 +1016,7 @@ class KotlinJsonAdapterTest {
|
||||
mapWildcardsParameterizedTest(
|
||||
MapOfStringToArrayReflection::class.java,
|
||||
"""{"map":{"key":[]}}""",
|
||||
MapOfStringToArrayReflection(mapOf("key" to arrayOf()))
|
||||
MapOfStringToArrayReflection(mapOf("key" to arrayOf())),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1025,7 +1027,7 @@ class KotlinJsonAdapterTest {
|
||||
mapWildcardsParameterizedTest(
|
||||
MapOfStringToArrayCodegen::class.java,
|
||||
"""{"map":{"key":[]}}""",
|
||||
MapOfStringToArrayCodegen(mapOf("key" to arrayOf()))
|
||||
MapOfStringToArrayCodegen(mapOf("key" to arrayOf())),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1037,7 +1039,7 @@ class KotlinJsonAdapterTest {
|
||||
mapWildcardsParameterizedTest(
|
||||
MapOfStringToClassReflection::class.java,
|
||||
"""{"map":{"key":{"a":19,"b":42}}}""",
|
||||
MapOfStringToClassReflection(mapOf("key" to ConstructorParameters(19, 42)))
|
||||
MapOfStringToClassReflection(mapOf("key" to ConstructorParameters(19, 42))),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1048,7 +1050,7 @@ class KotlinJsonAdapterTest {
|
||||
mapWildcardsParameterizedTest(
|
||||
MapOfStringToClassCodegen::class.java,
|
||||
"""{"map":{"key":{"a":19,"b":42}}}""",
|
||||
MapOfStringToClassCodegen(mapOf("key" to ConstructorParameters(19, 42)))
|
||||
MapOfStringToClassCodegen(mapOf("key" to ConstructorParameters(19, 42))),
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user