{"action":"created","issue":{"url":"https://api.github.com/repos/FasterXML/jackson-module-jaxb-annotations/issues/39","labels_url":"https://api.github.com/repos/FasterXML/jackson-module-jaxb-annotations/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/FasterXML/jackson-module-jaxb-annotations/issues/39/comments","events_url":"https://api.github.com/repos/FasterXML/jackson-module-jaxb-annotations/issues/39/events","html_url":"https://github.com/FasterXML/jackson-module-jaxb-annotations/issues/39","id":56748152,"number":39,"title":"JaxbAnnotationIntrospector does not honor JsonInclude.Include.NON_EMPTY set on ObjectMapper","user":{"login":"jdmichal","id":1047723,"avatar_url":"https://avatars.githubusercontent.com/u/1047723?v=3","gravatar_id":"","url":"https://api.github.com/users/jdmichal","html_url":"https://github.com/jdmichal","followers_url":"https://api.github.com/users/jdmichal/followers","following_url":"https://api.github.com/users/jdmichal/following{/other_user}","gists_url":"https://api.github.com/users/jdmichal/gists{/gist_id}","starred_url":"https://api.github.com/users/jdmichal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdmichal/subscriptions","organizations_url":"https://api.github.com/users/jdmichal/orgs","repos_url":"https://api.github.com/users/jdmichal/repos","events_url":"https://api.github.com/users/jdmichal/events{/privacy}","received_events_url":"https://api.github.com/users/jdmichal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-02-05T23:43:58Z","updated_at":"2015-02-06T22:22:24Z","closed_at":null,"body":"I am configuring a Jackson JSON provider with a JAX-RS application's `getSingletons()` method. Note setting of `NON_EMPTY`:\r\n\r\n```java\r\nfinal ObjectMapper objectMapper = new ObjectMapper();\r\nobjectMapper.registerModule(new JaxbAnnotationModule());\r\nobjectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);\r\nfinal JacksonJaxbJsonProvider jsonProvider = new JacksonJaxbJsonProvider(\r\n    objectMapper, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS);\r\n```\r\nLet's also define a piece of dummy data:\r\n\r\n```java\r\n@XmlType\r\npublic class Data {\r\n    private final List<Object> stuff = new java.util.ArrayList<Object>();\r\n\r\n    @XmlElement\r\n    public List<Object> getStuff() {\r\n        return this.stuff;\r\n    }\r\n}\r\n```\r\n\r\nGiven that `stuff` is empty, I would expect this to output an empty object. However, it instead outputs:\r\n\r\n```javascript\r\n{\r\n    \"stuff\": [ ]\r\n}\r\n```\r\n\r\nI have isolated this behavior to [`JaxbAnnotationIntrospector.findSerializationInclusion`](https://github.com/FasterXML/jackson-module-jaxb-annotations/blob/jackson-module-jaxb-annotations-2.4.4/src/main/java/com/fasterxml/jackson/module/jaxb/JaxbAnnotationIntrospector.java#L729). (This is the 2.4.4 version, but this function is currently unmodified on master.) This function receives the default value of `NON_EMPTY`, but will return `NON_NULL` as long as the `XmlElement` annotation is present.\r\n\r\nGiven that this behavior is unexpected given the configuration, and also conflicts with the JAXB behavior of not serializing the list, I believe this function should return `NON_EMPTY` instead of `NON_NULL` if:\r\n* `XmlElementWrapper` is not present. (JAXB would output an empty element with the wrapper's name.)\r\n* `XmlElement` is present.\r\n* The given default is NON_EMPTY."},"comment":{"url":"https://api.github.com/repos/FasterXML/jackson-module-jaxb-annotations/issues/comments/73323878","html_url":"https://github.com/FasterXML/jackson-module-jaxb-annotations/issues/39#issuecomment-73323878","issue_url":"https://api.github.com/repos/FasterXML/jackson-module-jaxb-annotations/issues/39","id":73323878,"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":"2015-02-06T22:22:24Z","updated_at":"2015-02-06T22:22:24Z","body":"Ok. Yes, it's that `nillable` thing.\r\n\r\nAfter thinking this through, I _think_ it is safe to assume that `nillable=false` can be ignored wrt serialization includion setting. None of the tests assumes semantics for that, and interpretation seems to be that nillability simply enforces inclusion (since null is an explicitly allowed choice).\r\nSo, I will fix this for 2.5.1.\r\n"}}