-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
works-as-intendedFor issues closed due to (new) behavior observed is as intended and not a flawFor issues closed due to (new) behavior observed is as intended and not a flaw
Description
Search before asking
- I searched in the issues and found nothing similar.
Describe the bug
Hi,
I am using jackson 3.0.4 and 3.1.0 and it fails to deserialize properties which are somewhat special in terms of section 8.8 of the bean spec.
If you have a property xFieldHint the Getters and Setters have their first value lower-cased, instead of usually upper-cased.
But Jackson fails to read that - instead of getxFieldHint / setxFieldHint you must use getXFieldHint / setXFieldHint - imho this is wrong, that breaks a lot of code which works with Jackson 2 and e.g. eclipse / IntelliJ ([0]) have the same convention from the spec to have a lower case letter here.
Example:
import org.junit.jupiter.api.Test;
import tools.jackson.databind.json.JsonMapper;
import static org.assertj.core.api.Assertions.assertThat;
public class Jackson3Test {
public static class Pojo {
private String xFieldHint;
public String getxFieldHint() {
return xFieldHint;
}
public void setxFieldHint(String xFieldHint) {
this.xFieldHint = xFieldHint;
}
}
@Test
void test() {
final JsonMapper mapper = JsonMapper.builder().build();
final Pojo pojo = mapper.readValue("""
{ "xFieldHint" : "test" }
""", Pojo.class);
assertThat(pojo.getxFieldHint()).isEqualTo("test");
}
}
That should work imho, but it does not.
Version Information
3.0.4 / 3.1.0
Reproduction
See above.
Expected behavior
Example above should work.
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
works-as-intendedFor issues closed due to (new) behavior observed is as intended and not a flawFor issues closed due to (new) behavior observed is as intended and not a flaw