mirror of
https://github.com/fankes/moshi.git
synced 2025-10-19 16:09:21 +08:00
Merge pull request #523 from hzsweers/z/nonNullTypeVariabels
Fix nullable properties of TypeVariable types
This commit is contained in:
@@ -222,14 +222,16 @@ class GeneratedAdaptersTest {
|
||||
listOf("foo", null, "bar"),
|
||||
setOf("foo", null, "bar"),
|
||||
mapOf("foo" to "bar", "baz" to null),
|
||||
null
|
||||
null,
|
||||
1
|
||||
)
|
||||
|
||||
val noNullsTypeParams = NullableTypeParams<Int>(
|
||||
nullableTypeParams.nullableList,
|
||||
nullableTypeParams.nullableSet,
|
||||
nullableTypeParams.nullableMap.filterValues { it != null },
|
||||
null
|
||||
null,
|
||||
1
|
||||
)
|
||||
|
||||
val json = adapter.toJson(nullableTypeParams)
|
||||
@@ -781,7 +783,8 @@ data class NullableTypeParams<T>(
|
||||
val nullableList: List<String?>,
|
||||
val nullableSet: Set<String?>,
|
||||
val nullableMap: Map<String, String?>,
|
||||
val nullableT: T?
|
||||
val nullableT: T?,
|
||||
val nonNullT: T
|
||||
)
|
||||
|
||||
typealias TypeAliasName = String
|
||||
|
Reference in New Issue
Block a user