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

2.10.1 seems to output JSON field where name of function matches name of private field #270

Closed
daviddenton opened this issue Nov 18, 2019 · 4 comments
Milestone

Comments

@daviddenton
Copy link
Contributor

daviddenton commented Nov 18, 2019

Behaviour change, this code produces a different result to 2.10.0, where field would not be rendered:

data class Wrapper(private val field: String) {
    val upper = field.toUpperCase()
    fun field() = field
    fun stillAField() = field
}

fun main() {
    println(
        ObjectMapper()
            .registerModule(KotlinModule())
            .writeValueAsString(Wrapper("hello"))
    )
}

produces:

{"field":"hello","upper":"HELLO"}

@apatrida
Copy link
Member

apatrida commented Dec 6, 2019

@cowtowncoder anything in databind that would cause that? I'm checking the diff from 2.10.0 to 2.10.1 of the Kotlin module in case, but not sure what could have that impact.

@cowtowncoder
Copy link
Member

No changes in databind, but I wonder if fix here for #80 might have this as side effect? (as that was added in 2.10.1 but not in 2.10.0
If so, bit stricter checks might help. I'll see if I can reproduce the issue as there's now a failing test.

@cowtowncoder
Copy link
Member

Yes, looks like there's accidental match. I think I can fix this quite easily, in time for 2.10.2.

@cowtowncoder
Copy link
Member

2.10.2 now released.

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

No branches or pull requests

3 participants