Avoid deprecated newInstance() call on Class

This commit is contained in:
Mikołaj Pich 2020-01-10 15:10:01 +01:00
parent 2574f94cda
commit f9c30bf119
No known key found for this signature in database
GPG key ID: F62B26E36D4C4BAA

View file

@ -13,7 +13,7 @@ class DateDeserializer<T : Date>(private val mClazz: Class<T>) : JsonDeserialize
override fun deserialize(element: JsonElement, arg1: Type, context: JsonDeserializationContext): T {
val dateString = element.asString
return try {
mClazz.newInstance().apply {
mClazz.getDeclaredConstructor().newInstance().apply {
time = dateString.toDate(GradeDate.FORMAT).time
}
} catch (e: Throwable) {