title: JSON with Jackson: Desirialize fails if abstract methods are used (Polymorphic Type Handling)
body: <p>i have a question concerning Json deserialization with Jackson <strong><em>(edit: 2.0.4 version)</em></strong>. I would like serialize an Bean, containing the list of other beans, as string , save this string and then to deserialize later this string. I use the some base class and its subtypes.  The basis class Parent  is an abstract class, that has two attributes with getters und setters, this class has also an abstract method getType().   Other abstract class AbstractChild  inherits from class Parent . This class has attributes too and isExportEnabled() abstract method. 
  I have no problems, if this Bean will be serialized. I use the following annotation on the <em>Parent</em> class
  *@JsonTypeInfo(use = JsonTypeInfo.Id.MINIMAL_CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@cls")*
   The string will be generated. 
  But the  desirialize failed: the exception  “Unrecognized field "type"”will be thrown.  But I need this attribute! I’m tried to set  @JsonProperty("type") on abstract method, this has no effect.
   Please help me.</p>
  
  <p><strong>edit: if i introduce the private fields "type" (Parent) and "exportEnabled" (AbstractChild) so it runs correctly.</strong>
  P.S The exception</p>
  
  <blockquote>
    <p>com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException:
    Unrecognized field "type" (class tst.SimpleTestMain$FirstChild), not
    marked as ignorable (4 known properties: , "id", "maxCount", "code",
    "minCount"])  at [Source: java.io.StringReader@1ad9fa; line: 1,
    column: 125] (through reference chain:
    tst.Fam["members"]->tst.FirstChild["type"])   at
    com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:79)
      at
    com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:568)</p>
  </blockquote>
  
  <h2>…and the example class</h2>
  
  <pre><code>package tst;
  
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.List;
  import com.fasterxml.jackson.annotation.JsonProperty;
  import com.fasterxml.jackson.annotation.JsonTypeInfo;
  import com.fasterxml.jackson.databind.ObjectMapper;
  
  public class SimpleTestMain {
  
      enum Type {
          TYPE_A, TYPE_B
      }
  
      @JsonTypeInfo(use = JsonTypeInfo.Id.MINIMAL_CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@cls")
      public static abstract class Parent {
  
          private int id;
  
          private String code;
  
          public Parent() {
  
          }
          @JsonProperty("type")
          // First abstract getter
          public abstract Type getType();
  
          public int getId() {
              return id;
          }
  
          public void setId(int id) {
              this.id = id;
          }
  
          public String getCode() {
              return code;
          }
  
          public void setCode(String code) {
              this.code = code;
          }
  
      }
  
      public static abstract class AbstractChild extends Parent {
  
          private int minCount;
  
          private int maxCount;
  
          public AbstractChild() {
  
          }
  
          // Second abstract method: boolean used
          public abstract boolean isExportEnabled();
  
          public int getMinCount() {
              return minCount;
          }
  
          public void setMinCount(int minCount) {
              this.minCount = minCount;
          }
  
          public int getMaxCount() {
              return maxCount;
          }
  
          public void setMaxCount(int maxCount) {
              this.maxCount = maxCount;
          }
  
      }
  
      public static class FirstChild extends AbstractChild {
  
          @Override
          public boolean isExportEnabled() {
              return false;
          }
  
          @Override
          public Type getType() {
              return Type.TYPE_A;
          }
  
      }
  
      public static class SecondChild extends AbstractChild {
  
          @Override
          public boolean isExportEnabled() {
              return true;
          }
  
          @Override
          public Type getType() {
              return Type.TYPE_B;
          }
  
      }
  
      public static class Fam {
          private int famId;
  
          private List&lt;Parent&gt; members;
  
          public Fam() {
              members = new ArrayList&lt;Parent&gt;();
          }
  
          public int getFamId() {
              return famId;
          }
  
          public void setFamId(int famId) {
              this.famId = famId;
          }
  
          public List&lt;Parent&gt; getMembers() {
              return members;
          }
  
          public void setMembers(List&lt;Parent&gt; members) {
              this.members = members;
          }
  
          public void addMember(Parent member) {
              members.add(member);
          }
  
      }
  
      public SimpleTestMain() {
      }
  
      public static void main(String[] args) {
          Fam fam = new Fam();
          FirstChild fc = new FirstChild();
          fc.setId(1);
          fc.setCode("FirstChildCode");
          fc.setMinCount(1);
          fc.setMaxCount(4);
  
          fam.addMember(fc);
  
          SecondChild sc = new SecondChild();
  
          sc.setCode("SecondChildCode");
          sc.setMinCount(131);
          sc.setMaxCount(431);
  
          fam.addMember(sc);
          String test = "";
          // Serialize it
          ObjectMapper mapper = new ObjectMapper();
          try {
              test = mapper.writeValueAsString(fam);
              System.out.println("Serialized bean:\n" + test);
              // the output
              // Serialized bean:
              // {"famId":0,"members":[{"@cls":".SimpleTestMain$FirstChild","id":1,"code":"FirstChildCode","minCount":1,"maxCount":4,"type":"TYPE_A","exportEnabled":false},{"@cls":".SimpleTestMain$SecondChild","id":0,"code":"SecondChildCode","minCount":131,"maxCount":431,"type":"TYPE_B","exportEnabled":true}]}
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          // Deserialize it
          mapper = new ObjectMapper();
  
          //      mapper.enableDefaultTyping();
          try {
              Fam fam1 = mapper.readValue(test, Fam.class);
  
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>