{"action":"created","issue":{"url":"https://api.github.com/repos/FasterXML/jackson-databind/issues/1133","repository_url":"https://api.github.com/repos/FasterXML/jackson-databind","labels_url":"https://api.github.com/repos/FasterXML/jackson-databind/issues/1133/labels{/name}","comments_url":"https://api.github.com/repos/FasterXML/jackson-databind/issues/1133/comments","events_url":"https://api.github.com/repos/FasterXML/jackson-databind/issues/1133/events","html_url":"https://github.com/FasterXML/jackson-databind/issues/1133","id":134381571,"number":1133,"title":"Class cast exception when data binding to a custom collection class","user":{"login":"lexspoon","id":274906,"avatar_url":"https://avatars.githubusercontent.com/u/274906?v=3","gravatar_id":"","url":"https://api.github.com/users/lexspoon","html_url":"https://github.com/lexspoon","followers_url":"https://api.github.com/users/lexspoon/followers","following_url":"https://api.github.com/users/lexspoon/following{/other_user}","gists_url":"https://api.github.com/users/lexspoon/gists{/gist_id}","starred_url":"https://api.github.com/users/lexspoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lexspoon/subscriptions","organizations_url":"https://api.github.com/users/lexspoon/orgs","repos_url":"https://api.github.com/users/lexspoon/repos","events_url":"https://api.github.com/users/lexspoon/events{/privacy}","received_events_url":"https://api.github.com/users/lexspoon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-17T19:47:50Z","updated_at":"2016-02-22T13:24:06Z","closed_at":null,"body":"I have a data model that I could data-bind automatically using Jackson 2.2.0, but that has stopped working as of 2.6.0 and 2.6.4. Sorry if this is a duplicate report, but I thought you could at least use it as a test case even if so.\r\n\r\nThe custom collection class has a definition like this:\r\n```\r\npublic final class Seq<T> extends AbstractList<T> {\r\n\t@JsonCreator\r\n\tpublic static <T> Seq<T> of(Iterable<T> elems) { ... }\r\n\t...\r\n}\r\n```\r\n\r\nHere's a typical use of this class in another data model:\r\n```\r\npublic class BuildGraph {\r\n\t@JsonCreator\r\n\tpublic BuildGraph(@JsonProperty(\"environ\") Seq<String> environ,\r\n\t\t\t@JsonProperty(\"localenv\") Seq<String> localenv,\r\n\t\t\t@JsonProperty(\"rules\") Seq<BuildRule> rules) { ... }\r\n\t...\r\n```\r\n\r\nWith Jackson 2.6.0 or 2.6.4, trying to deserialize into this model gives me the following class cast exception:\r\n```\r\njava.util.LinkedHashMap cannot be cast to com.semmle.bcache.BuildRule\r\n```\r\n\r\nI've shrunk my code base to a small skeleton of code that still reproduces the error. I don't see a way to attach things to a GitHub issue ticket, so I pushed it to a new repository:\r\n\r\nhttps://github.com/lexspoon/bug-jackson-data-bind-seq\r\n\r\nTo run the test, just run `./run.sh`. You can edit the file to change which version of Jackson gets used.\r\n\r\nI believe this should work, or at least not yield a class cast exception. However, I am also interested if there is anyway to annotate the Seq class so that this will work. My current workaround is to accept java.util.List in constructor parameters and then manually convert it to a Seq in the constructor, but that's not nearly as nice as if Jackson can data bind Seq automatically.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/FasterXML/jackson-databind/issues/comments/187170141","html_url":"https://github.com/FasterXML/jackson-databind/issues/1133#issuecomment-187170141","issue_url":"https://api.github.com/repos/FasterXML/jackson-databind/issues/1133","id":187170141,"user":{"login":"lexspoon","id":274906,"avatar_url":"https://avatars.githubusercontent.com/u/274906?v=3","gravatar_id":"","url":"https://api.github.com/users/lexspoon","html_url":"https://github.com/lexspoon","followers_url":"https://api.github.com/users/lexspoon/followers","following_url":"https://api.github.com/users/lexspoon/following{/other_user}","gists_url":"https://api.github.com/users/lexspoon/gists{/gist_id}","starred_url":"https://api.github.com/users/lexspoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lexspoon/subscriptions","organizations_url":"https://api.github.com/users/lexspoon/orgs","repos_url":"https://api.github.com/users/lexspoon/repos","events_url":"https://api.github.com/users/lexspoon/events{/privacy}","received_events_url":"https://api.github.com/users/lexspoon/received_events","type":"User","site_admin":false},"created_at":"2016-02-22T13:24:06Z","updated_at":"2016-02-22T13:24:06Z","body":"Good news--the problem is fixed as of 2.7.0.\r\n\r\nI'll leave this open in case you want to add the data model as a test case. It uses a custom Java collection subclass, so it should be a good exercise of the generics logic in jackson-databind.\r\n"}}