Skip to content

Commit

Permalink
fix: use declaredMemberProperties rather than memberProperties as to …
Browse files Browse the repository at this point in the history
…not look for @id on super-classes
  • Loading branch information
joshbker committed Feb 16, 2024
1 parent 566b86f commit cf7e5bc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/kotlin/gg/flyte/twilight/data/MongoDB.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ import kotlin.reflect.KClass
import kotlin.reflect.KProperty
import kotlin.reflect.KProperty1
import kotlin.reflect.KType
import kotlin.reflect.full.memberProperties
import kotlin.reflect.full.declaredMemberProperties
import kotlin.reflect.jvm.javaField
import kotlin.reflect.jvm.javaType

object MongoDB {

Expand Down Expand Up @@ -153,7 +152,7 @@ data class IdField(val clazz: KClass<out MongoSerializable>) {
val type: KType

init {
val idFields = clazz.memberProperties.filter { it.javaField?.isAnnotationPresent(Id::class.java) == true }
val idFields = clazz.declaredMemberProperties.filter { it.javaField?.isAnnotationPresent(Id::class.java) == true }
println(idFields)

require(idFields.size == 1) {
Expand Down

0 comments on commit cf7e5bc

Please sign in to comment.