Use entries instead of values as its recommended after kotlin 1.9 (#3718)

Use entries instead of values as its  recommended after kotlin 1.9
This commit is contained in:
Tamim Hossain authored and GitHub committed 2024-10-21 14:01:44 +08:00
1 parent 22cef29c27
commit 5a5f911453
2 files changed
+2 -2

No files matched your search

@@ -16,6 +16,6 @@ enum class EConfigType(val value: Int, val protocolScheme: String) {
HTTP(10, AppConfig.HTTP);
companion object {
fun fromInt(value: Int) = values().firstOrNull { it.value == value }
fun fromInt(value: Int) = entries.firstOrNull { it.value == value }
}
}
@@ -23,7 +23,7 @@ object JsonUtil {
val gsonPre = GsonBuilder()
.setPrettyPrinting()
.disableHtmlEscaping()
.registerTypeAdapter( // custom serialiser is needed here since JSON by default parse number as Double, core will fail to start
.registerTypeAdapter( // custom serializer is needed here since JSON by default parse number as Double, core will fail to start
object : TypeToken<Double>() {}.type,
JsonSerializer { src: Double?, _: Type?, _: JsonSerializationContext? ->
JsonPrimitive(