Unwrapped lists cannot be deserialized when using JsonTypeInfo.As.EXISTING_PROPERTY (original) (raw)

If the UnwrappedPolymorphicList490Test is changed to the following:

package com.fasterxml.jackson.dataformat.xml.lists;

import java.util.*;

import org.junit.jupiter.api.Test;

import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import com.fasterxml.jackson.dataformat.xml.XmlTestUtil;

import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull;

public class UnwrappedPolymorphicList490Test extends XmlTestUtil { @JsonTypeInfo( use = JsonTypeInfo.Id.NAME,

}

the deserialization breaks with this error:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `java.util.ArrayList` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('type1')
 at [Source: (StringReader); line: 1, column: 112] (through reference chain: com.fasterxml.jackson.dataformat.xml.lists.UnwrappedPolymorphicList490Test$MyType490["typeNames"])

Is that to be expected?