Skip to content

Commit ee4e415

Browse files
committed
Tighter type constraint
1 parent b96c0b9 commit ee4e415

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

common/src/main/kotlin/com/lambda/config/settings/collections/ListSetting.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ package com.lambda.config.settings.collections
22

33
import com.google.gson.JsonElement
44
import com.google.gson.reflect.TypeToken
5+
import com.lambda.Lambda.LOG
56
import com.lambda.Lambda.gson
67
import com.lambda.config.AbstractSetting
8+
import com.lambda.util.DynamicReflectionSerializer.dynamicString
79

810
class ListSetting<T>(
911
override val name: String,
@@ -17,6 +19,9 @@ class ListSetting<T>(
1719
) {
1820
override fun loadFromJson(serialized: JsonElement) {
1921
val listType = object : TypeToken<List<T>>() {}.type
20-
value = gson.fromJson(serialized, listType)
22+
LOG.info("Loading $name with value $serialized current value ${value.dynamicString()} $value and type ${listType.typeName}")
23+
val dese = gson.fromJson<List<T>>(serialized, listType)
24+
value = dese
25+
LOG.info("Loaded $name with value ${value.dynamicString()} $value and type ${listType.typeName}")
2126
}
2227
}

common/src/main/kotlin/com/lambda/gui/impl/clickgui/GuiConfigurable.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ package com.lambda.gui.impl.clickgui
22

33
import com.lambda.config.Configurable
44
import com.lambda.config.configurations.GuiConfig
5-
import com.lambda.gui.api.component.WindowComponent
65
import com.lambda.gui.impl.clickgui.windows.TagWindow
76

87
object GuiConfigurable : Configurable(GuiConfig) {
98
override val name = "ClickGui"
10-
val windows = setting("windows", listOf<WindowComponent<*>>(TagWindow()))
9+
val windows = setting("windows", listOf(TagWindow()))
1110
}

0 commit comments

Comments
 (0)