Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations are not collected for object kinds #708

Closed
cy6erGn0m opened this issue Feb 17, 2020 · 0 comments
Closed

Annotations are not collected for object kinds #708

cy6erGn0m opened this issue Feb 17, 2020 · 0 comments

Comments

@cy6erGn0m
Copy link

Describe the bug

getEntityAnnotations() for an object descriptor is empty in spite of that the annotation class is marked with @SerialInfo meta-annotation. This works well for regular classes.

To Reproduce

class ObjectSerialInfoTest {

    @Test
    @ImplicitReflectionSerializer
    fun annotations() {
        val childDescriptor = serializer<Root.Child>().descriptor
        assertEquals(1, childDescriptor.getEntityAnnotations().size)
        assertEquals(22, (childDescriptor.getEntityAnnotations().single() as MetaData).metaValue)
        assertEquals(2, childDescriptor.elementsCount)
        
        val rootDescriptor = childDescriptor.getElementDescriptor(1)
        assertEquals(1, rootDescriptor.getEntityAnnotations().size)
        assertEquals(11, (childDescriptor.getEntityAnnotations().single() as MetaData).metaValue)
    }

    @SerialInfo
    annotation class MetaData(val metaValue: Int)

    @Serializable
    @MetaData(11)
    object Root {

        @Serializable
        @MetaData(22)
        class Child(val id: Int, val root: Root = Root)
    }
}

Expected behaviour

SerialDescriptor should work the same as for a regular class descriptor - it should return annotations and the test should pass.

Environment

  • Kotlin version: 1.3.61
  • Library version: 0.14.0
  • Kotlin platforms: JVM
@cy6erGn0m cy6erGn0m added the bug label Feb 17, 2020
sandwwraith added a commit that referenced this issue May 25, 2021
…erialzers

Enables support of @SerialInfo class-level annotation on such classes

Fixes #708
Fixes #1240
sandwwraith added a commit that referenced this issue Jul 20, 2021
…erialzers

Enables support of @SerialInfo class-level annotation on such classes

Fixes #708
Fixes #1240
sandwwraith added a commit that referenced this issue Aug 12, 2021
…erialzers

Enables support of @SerialInfo class-level annotation on such classes

Fixes #708
Fixes #1240
sandwwraith added a commit that referenced this issue Aug 24, 2021
…erialzers

Enables support of @SerialInfo class-level annotation on such classes

Fixes #708
Fixes #1240
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants