-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
to-evaluateIssue that has been received but not yet evaluatedIssue that has been received but not yet evaluated
Description
Here is a small main reproducing the behaviour change:
import com.fasterxml.jackson.annotation.JsonAutoDetect
import com.fasterxml.jackson.annotation.PropertyAccessor
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.KotlinModule
fun main() {
val mapper = ObjectMapper().apply {
registerModule(KotlinModule.Builder().build())
setVisibility(PropertyAccessor.IS_GETTER, JsonAutoDetect.Visibility.NONE)
}
class Foo(val bar: Int) {
val isZero get() = bar == 0
}
println(mapper.writeValueAsString(Foo(1)))
// with Jackson 2.14.2, prints: {"bar":1}
// with Jackson 2.15.0, prints: {"bar":1,"isZero":false}
}
We serialize these classes with setVisibility(PropertyAccessor.IS_GETTER, Visibility.NONE) to ignore the isXXX methods, and please note that we cannot use @JsonIgnore ("This annotation is not applicable to target 'member property without backing field or delegate'").
Starting with Jackson 2.15.0, the isZero property is serialized, then the deserialization fails.
The way we use the visibility feature looks fine to me, this property was correctly ignored at serialization with version 2.14.2, so I would say the 2.15 change does look like a regression.
Metadata
Metadata
Assignees
Labels
to-evaluateIssue that has been received but not yet evaluatedIssue that has been received but not yet evaluated