-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
修复 kotlin data class 可空字段携带的默认值没有生效问题
修复 kotlin data class 非空且没有默认值的字段导致解析报错的问题
- Loading branch information
1 parent
524a25c
commit 2bc5aa5
Showing
15 changed files
with
112 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 9 additions & 6 deletions
15
app/src/androidTest/java/com/hjq/gson/factory/test/DataClassBean.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
package com.hjq.gson.factory.test | ||
|
||
data class DataClassBean( | ||
val name: String = "轮子哥", | ||
val alias: String, | ||
val address: String? = "", | ||
val age: Int = 20, | ||
val weight: Int, | ||
val stature: Int? = 180, | ||
var name: String = "轮子哥", | ||
var alias: String, | ||
var address: String? = "", | ||
var company: String?, | ||
var age: Int = 20, | ||
var weight: Int, | ||
var stature: Int? = 180, | ||
var interest: List<String>, | ||
var child: DataClassChildBean | ||
) |
6 changes: 6 additions & 0 deletions
6
app/src/androidTest/java/com/hjq/gson/factory/test/DataClassChildBean.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.hjq.gson.factory.test | ||
|
||
data class DataClassChildBean( | ||
val corporation: String?, | ||
val unmarried: Boolean = true | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.