-
Notifications
You must be signed in to change notification settings - Fork 20
@XmlType(propOrder=
) overrides propOrder
of super classes; should merge
#66
Comments
I appreciate your suggestion, but the way generic annotation handling works there is no way to merge annotations this way. Perhaps with Jackson 3.x we can try to tackle this, since it would ultimately make sense for many annotations (but not all): but it has to be done in a way that does not require annotation handler to be aware of specific semantics of all annotations. |
Forgot to add: there is actually issue filed for this, at: FasterXML/jackson-annotations#82 so not closing as invalid or anything, but simply as duplicate |
@XmlType(propOrder=
) overrides propOrder
of super classes; should merge
Thank you very much for your quick answer. Since it's simply working for us we will wait (maybe for Jackson 3.x). Your proposal sounds interesting, im tense how this will be implemented. |
@ajdergute yes, I think your local fix makes sense for your usage. The problem from jackson perspective is that in general similar fix is impractical based on division of responsibilities between different parts:
There are also practical concerns of But none of these is necessary by application code that can omit/skip parts that are not necessary, or are known to follow specific patterns. |
Consider the following setup:
Property order with Jackson now is:
prop3, prop2, prop1, prop4
Expected serializaton:
prop4, prop1, prop2, prop3
It isn't possible to mention prop1 or prop4 in propOrder of class Child, because this class has no getter or setter for this property. I know that there exist more than one assumption how properties are ordered, but to ignore propOrder of super class seems not the desired behaviour.
I tracked down this issue and strongly assume that it's because
JaxbAnnotationIntrospector#findSerializationPropertyOrder(AnnotatedClass)
doesn't traverse super classes. Thus I changed this method as follows:Please change the code like above.
This fixed the issue for us. If one can tell me what's needed (tests?) for a successful pull request I'm willing to create one.
The text was updated successfully, but these errors were encountered: