Last active
September 30, 2017 12:23
-
-
Save qwert2603/d08e0086f5a07462d6907eb59f381063 to your computer and use it in GitHub Desktop.
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
import com.google.gson.Gson | |
import com.google.gson.annotations.SerializedName | |
data class Q @JvmOverloads constructor( | |
val i: Int, | |
@SerializedName("list") val list: List<String> = emptyList() | |
) | |
fun main(args: Array<String>) { | |
val gson = Gson() | |
val q = gson.fromJson("{\"i\": 42}", Q::class.java) | |
println(q) | |
println(q.list.size) // NPE !!! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment