mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-11 02:50:15 +08:00
Support ArrayList, LinkedHashMap, HashMap, LinkedHashSet, HashSet for value()
This commit is contained in:
parent
d120bfe576
commit
5adda00be0
@ -44,7 +44,9 @@ internal fun Setting.valueFromKTypeImpl(type: KType): SerializerAwareValue<*> {
|
|||||||
|
|
||||||
when (classifier) {
|
when (classifier) {
|
||||||
MutableMap::class,
|
MutableMap::class,
|
||||||
Map::class
|
Map::class,
|
||||||
|
LinkedHashMap::class,
|
||||||
|
HashMap::class
|
||||||
-> {
|
-> {
|
||||||
val keyClass = type.arguments[0].type?.classifier
|
val keyClass = type.arguments[0].type?.classifier
|
||||||
require(keyClass is KClass<*>)
|
require(keyClass is KClass<*>)
|
||||||
@ -63,10 +65,9 @@ internal fun Setting.valueFromKTypeImpl(type: KType): SerializerAwareValue<*> {
|
|||||||
).serializableValueWith(serializerMirai(type) as KSerializer<Map<Any?, Any?>>) // erased
|
).serializableValueWith(serializerMirai(type) as KSerializer<Map<Any?, Any?>>) // erased
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collection::class,
|
|
||||||
MutableCollection::class,
|
|
||||||
MutableList::class,
|
MutableList::class,
|
||||||
List::class
|
List::class,
|
||||||
|
ArrayList::class
|
||||||
-> {
|
-> {
|
||||||
val elementClass = type.arguments[0].type?.classifier
|
val elementClass = type.arguments[0].type?.classifier
|
||||||
require(elementClass is KClass<*>)
|
require(elementClass is KClass<*>)
|
||||||
@ -81,7 +82,9 @@ internal fun Setting.valueFromKTypeImpl(type: KType): SerializerAwareValue<*> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
MutableSet::class,
|
MutableSet::class,
|
||||||
Set::class
|
Set::class,
|
||||||
|
LinkedHashSet::class,
|
||||||
|
HashSet::class
|
||||||
-> {
|
-> {
|
||||||
val elementClass = type.arguments[0].type?.classifier
|
val elementClass = type.arguments[0].type?.classifier
|
||||||
require(elementClass is KClass<*>)
|
require(elementClass is KClass<*>)
|
||||||
|
Loading…
Reference in New Issue
Block a user