rad
03/03/2025, 6:37 PMKProperty<*>
in a delegate like such:
operator fun <T : GameDataEntry> getValue(
thisRef: Any?,
property: KProperty<*>
): T {
@Suppress("UNCHECKED_CAST")
return requireNotNull(getData(property.returnType.classifier as KClass<T>))
}
Using Kotlin 2.1.10, is this a bug or am I just doing something wrong? The exception happens even when just attempting to get the returnType
rad
03/03/2025, 7:07 PMinline fun <reified T : GameDataEntry> GameDataEntryHolder.data() = object : ReadWriteProperty<GameDataEntryHolder, T> {
override fun getValue(
thisRef: GameDataEntryHolder,
property: KProperty<*>
): T {
return requireNotNull(getData(T::class))
}
override fun setValue(
thisRef: GameDataEntryHolder,
property: KProperty<*>,
value: T
) {
setData(T::class, value)
}
}
Chris Lee
03/04/2025, 1:23 AMrad
03/04/2025, 6:32 AMrad
03/08/2025, 10:17 AMGameContext
and my caller class here being a GameInstance
with a delegating impl to my interface by the context