title: How does jackson @JsonGetter and @JsonSetter work
body: <p>I am using jackson 2.10.0 (<a href="https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core/2.10.0" rel="nofollow noreferrer">https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core/2.10.0</a>), following is a simple test case</p>
  
  <p>The Person class is defined as follows, for the setters, I have used the @JsonSetter annotation, and didn't use @JsonGetter for the getters,</p>
  
  <pre><code>import com.fasterxml.jackson.annotation.JsonProperty;
  
  public class Person {
      private String firstName;
      private String lastName;
  
      public String getFirstName() {
          return firstName;
      }
  
      @JsonSetter("first_name")
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      public String getLastName() {
          return lastName;
      }
  
      @JsonSetter("last_name")
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  
  }
  </code></pre>
  
  <p>Then, I create a Person object ,and serialize it as string,</p>
  
  <pre><code>import com.fasterxml.jackson.databind.ObjectMapper;
  
  
  public class Person3Test2 {
      public static void main(String[] args) throws Exception {
          Person p = new Person();
          p.setFirstName("abc");
          p.setLastName("def");
          String str = new ObjectMapper().writeValueAsString(p);
          System.out.println(str);
      }
  }
  </code></pre>
  
  <p>It will call Person's getters, since it doesn't use @JsonGetter, so I think the output should be</p>
  
  <pre><code>{"firstName":"abc","lastName":"def"}
  </code></pre>
  
  <p>But, I am surprised to find that it is :</p>
  
  <pre><code>{"first_name":"abc","last_name":"def"}
  </code></pre>
  
  <p>It looks that the @JsonSetter has affected the getter output, I would ask what's the behavior here.</p>