zodeus
01/24/2017, 5:32 PMdata class Response<out T>(
@Json(name = "success") val success: Boolean,
@Json(name = "data") val data: T
) {
init {
if (!success) {
throw RuntimeException("Failed...")
}
}
}
I think this is the line where moshi instantiates the object Object[] args = null; return (T) constructor.newInstance(args);
https://github.com/square/moshi/blob/master/moshi/src/main/java/com/squareup/moshi/ClassFactory.java#L44
My issue is that the init method doesn't get called.
Can anyone explain why?
Am I doing something wrong?