InsertKoinIO / koin

Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform
https://insert-koin.io
Apache License 2.0
9.08k stars 719 forks source link

'object MyObject { }' with two of @MetaSerializable error in serializer<MyObject>(), but MyObject.serializer() is working #1713

Closed Bruce0203 closed 9 months ago

Bruce0203 commented 12 months ago

Describe the bug same as title

To Reproduce run code snippet below

Expected behavior no error

Koin module and version: io.insert-koin:koin-core:3.5.0

@file:OptIn(ExperimentalSerializationApi::class)

import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.MetaSerializable
import kotlinx.serialization.serializer

@MetaSerializable
@Target(AnnotationTarget.CLASS)
@Repeatable
annotation class MySerializable

@MySerializable
@MySerializable
//two of MySerializable
class MyClass

@MySerializable
@MySerializable
//two of MySerializable
object MyObject

fun main() {
    MyClass.serializer()  //work
    serializer<MyClass>()  //work

    MyObject.serializer()  //work
    serializer<MyObject>()  //failed
}
arnaudgiuliani commented 9 months ago

what is the link with Koin framework?

Bruce0203 commented 9 months ago

what is the link with Koin framework?

Oh, I'm sorry, I'm in the wrong place!