Skip to content

2.15.0 changed the result of serialization of functions returning boolean #670

@PoisonedYouth

Description

@PoisonedYouth

Describe the bug
The result in serialization of a function returning a boolean is changed from version 2.14.2 and 2.15.0.

To Reproduce
2.14.2

interface TestInterface{
        fun isValid(): Boolean
    }

    class TestClass: TestInterface{
        override fun isValid(): Boolean {
            return true
        }
    }

    @Test
    fun `serialize`(){
        val test = TestClass()

        val actual = jacksonObjectMapper().writeValueAsString(test)

        assertThat(actual).isEqualTo("{\"valid\":true}")
    }

2.15.0

interface TestInterface{
        fun isValid(): Boolean
    }

    class TestClass: TestInterface{
        override fun isValid(): Boolean {
            return true
        }
    }

    @Test
    fun `serialize`(){
        val test = TestClass()

        val actual = jacksonObjectMapper().writeValueAsString(test)

        assertThat(actual).isEqualTo("{\"isValid\":true}")
    }

Expected behavior
The serialization of functions does not change.

Versions
Kotlin: 1.8.20
Jackson-module-kotlin: 2.15.2
Jackson-databind: SpringBoot: 3.0.6 (brings jackson-databind 2.14.2)

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions