{"action":"created","issue":{"url":"https://api.github.com/repos/FasterXML/jackson-datatypes-collections/issues/5","repository_url":"https://api.github.com/repos/FasterXML/jackson-datatypes-collections","labels_url":"https://api.github.com/repos/FasterXML/jackson-datatypes-collections/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/FasterXML/jackson-datatypes-collections/issues/5/comments","events_url":"https://api.github.com/repos/FasterXML/jackson-datatypes-collections/issues/5/events","html_url":"https://github.com/FasterXML/jackson-datatypes-collections/pull/5","id":148994101,"number":5,"title":"Guava Optional does not propagate TypeInfo.","user":{"login":"nbauernfeind","id":1030443,"avatar_url":"https://avatars.githubusercontent.com/u/1030443?v=3","gravatar_id":"","url":"https://api.github.com/users/nbauernfeind","html_url":"https://github.com/nbauernfeind","followers_url":"https://api.github.com/users/nbauernfeind/followers","following_url":"https://api.github.com/users/nbauernfeind/following{/other_user}","gists_url":"https://api.github.com/users/nbauernfeind/gists{/gist_id}","starred_url":"https://api.github.com/users/nbauernfeind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbauernfeind/subscriptions","organizations_url":"https://api.github.com/users/nbauernfeind/orgs","repos_url":"https://api.github.com/users/nbauernfeind/repos","events_url":"https://api.github.com/users/nbauernfeind/events{/privacy}","received_events_url":"https://api.github.com/users/nbauernfeind/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-17T20:38:52Z","updated_at":"2016-04-18T04:31:24Z","closed_at":"2016-04-17T22:44:40Z","pull_request":{"url":"https://api.github.com/repos/FasterXML/jackson-datatypes-collections/pulls/5","html_url":"https://github.com/FasterXML/jackson-datatypes-collections/pull/5","diff_url":"https://github.com/FasterXML/jackson-datatypes-collections/pull/5.diff","patch_url":"https://github.com/FasterXML/jackson-datatypes-collections/pull/5.patch"},"body":"The only functionality I haven't been able to restore in migrating Scala's Option to the new ReferenceType paradigm is propagating an `@JsonTypeInfo` annotation to the content type. The same issue currently exists with Guava's Optional and I can assume it exists with JDK Optional and AtomicReferences too.\r\n\r\nThe error with the test is this:\r\n```\r\nExpected :{\"value\":{\"$type\":\"Foo\",\"foo\":42}}\r\nActual   :{\"value\":[\"Present\",{\"type\":\"Foo\",\"foo\":42}]}\r\n```\r\n\r\nIf you replace the `Optional<Strategy>` with `Strategy` the test passes.\r\n\r\nIt's worth noting that `findCollectionLikeSerializer` can find the proper `TypeSerializer` via `type.getContentType().getTypeHandler()`. However `findReferenceType`'s referencedType has not already discovered this type handler.\r\n\r\nI'm still in the middle of tracking down where/how databind ends up doing something different between ReferenceType and CollectionLikeType. So far I've tracked the earliest difference (it differs earlier yet, though, I unfortunately have to take a break) to BeanSerializerBase.java:281 (First line of the for loop in resolve(SerializerProvider provider). The _props[i] for only the `CollectionLikeType` returns a \"hard coded\" version of JavaType (via `getSerializationType()`) that contains an `_elementType._TypeHandler`, whereas the `ReferenceType` variant does not have a \"hard coded\" serialization type."},"comment":{"url":"https://api.github.com/repos/FasterXML/jackson-datatypes-collections/issues/comments/211197114","html_url":"https://github.com/FasterXML/jackson-datatypes-collections/pull/5#issuecomment-211197114","issue_url":"https://api.github.com/repos/FasterXML/jackson-datatypes-collections/issues/5","id":211197114,"user":{"login":"cowtowncoder","id":55065,"avatar_url":"https://avatars.githubusercontent.com/u/55065?v=3","gravatar_id":"","url":"https://api.github.com/users/cowtowncoder","html_url":"https://github.com/cowtowncoder","followers_url":"https://api.github.com/users/cowtowncoder/followers","following_url":"https://api.github.com/users/cowtowncoder/following{/other_user}","gists_url":"https://api.github.com/users/cowtowncoder/gists{/gist_id}","starred_url":"https://api.github.com/users/cowtowncoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cowtowncoder/subscriptions","organizations_url":"https://api.github.com/users/cowtowncoder/orgs","repos_url":"https://api.github.com/users/cowtowncoder/repos","events_url":"https://api.github.com/users/cowtowncoder/events{/privacy}","received_events_url":"https://api.github.com/users/cowtowncoder/received_events","type":"User","site_admin":false},"created_at":"2016-04-18T04:31:24Z","updated_at":"2016-04-18T04:31:24Z","body":"Turns out the problem was in `jackson-databind`: handling of `@JsonTypeInfo` differs for structured types, but `ReferenceType` was not yet considered one, unlike array/Collection(Like)/Map(Like) types.\r\nFix will be in 2.7.4; now test passes. Should also work for Scala; I can verify JDK8 module."}}