title: Jackson mixin is ignored on serialization and deserialization
body: <p>I need to be able to create a Java POJO from a JSON object when I only have an interface that can't be changed.  I'm hoping that Mixins can help make this possible.  I created a Mixin that hopefully will work but can't get Jackson to use it.</p>
  <p>It appears that Jackson is ignoring the Mixin I am defining for both an Interface and an Implementation.  The test failures are what I would expect without the Mixin added to the ObjectMapper.</p>
  <p>Below is the simplest example that shows the problem.  The classes are each in their own package.  The real uses case is much more complex, including Lists of interfaces.  I am using Jackson 2.10.3.</p>
  <p>Any suggestions on what I'm doing wrong?</p>
  <p>Timothy</p>
  <p><strong>What doesn't work</strong></p>
  <p>The interface reader test fails with InvalidDefinitionException: Cannot construct instance of model.Level4 (no Creators, like default construct, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information</p>
  <p>Of secondary importance, the Mixin defines a new label (nameTest) for the name field which should be reflected in the output from writeValueAsString.  It outputs the field with the original value for the label (name).</p>
  <p><strong>Interface</strong></p>
  <pre><code>public interface Level4 {
      public Long getId();    
      public void setId(Long id);    
      public String getName();    
      public void setName(String name);
  }
  </code></pre>
  <p><strong>Implementation</strong></p>
  <pre><code>public class Level4Impl implements Level4 {
      private Long id;
      private String name;
  
      @Override
      public Long getId() {
          return id;
      }
  
      @Override
      public void setId(Long id) {
          this.id = id;
      }
  
      @Override
      public String getName() {
          return name;
      }
  
      @Override
      public void setName(String name) {
          this.name = name;
      }
  }
  </code></pre>
  <p><strong>Mixin</strong></p>
  <pre><code>public abstract class Level4Mixin {
      public Level4Mixin(
          @JsonProperty(&quot;id&quot;) Long id,
          @JsonProperty(&quot;nameTest&quot;) String name) { }
  }
  </code></pre>
  <p><strong>Unit Test</strong></p>
  <pre><code>class Level4MixinTest {
      private ObjectMapper mapper;
  
      @BeforeEach
      void setUp() throws Exception {
          mapper = new ObjectMapper();
          mapper.addMixIn(Level4.class, Level4Mixin.class);
          mapper.addMixIn(Level4Impl.class, Level4Mixin.class);
      }
  
      @Test
      void test_InterfaceWrite() throws JsonProcessingException {
          Level4 lvl4 = new Level4Impl();
          lvl4.setId(1L);
          lvl4.setName(&quot;test&quot;);
          String json = mapper.writeValueAsString(lvl4);
          assertNotNull(json);
          assertTrue(json.contains(&quot;nameTest&quot;));
      }
  
      @Test
      void test_InterfaceRead() throws JsonProcessingException {
          String json = &quot;{\&quot;id\&quot;:1,\&quot;nameTest\&quot;:\&quot;test\&quot;}&quot;;
          assertDoesNotThrow(() -&gt; {
              Level4 parsed = mapper.readValue(json, Level4.class);
              assertNotNull(parsed);
          });
      }
  
      @Test
      void test_ImplWrite() throws JsonProcessingException {
          Level4Impl lvl4 = new Level4Impl();
          lvl4.setId(1L);
          lvl4.setName(&quot;test&quot;);
          String json = mapper.writeValueAsString(lvl4);
          assertNotNull(json);
          assertTrue(json.contains(&quot;nameTest&quot;));
      }
  
      @Test
      void test_ImplRead() {
          String json = &quot;{\&quot;id\&quot;:1,\&quot;nameTest\&quot;:\&quot;test\&quot;}&quot;;
          assertDoesNotThrow(() -&gt; {
              Level4Impl parsed = mapper.readValue(json, Level4Impl.class);
              assertNotNull(parsed);
          });
      }
  }
  </code></pre>