jaxb
  1. jaxb
  2. JAXB-1013

xjc:substitutable does not work in JAXB 2.2.7 anymore

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2.7
    • Fix Version/s: None
    • Component/s: xjc
    • Labels:
      None

      Description

      The original Jira JAXB-289 proposed a solution to fix the substitution resulting in rather inconvenient JAXBElement<T> used when the type was abstract and part of a substitution group. Also the documentation at https://jaxb.java.net/2.2.7/docs/ch05.html#substitutable suggests that this feature should work.

      However it does not seem to work with JAXB-RI 2.2.7 anymore.

      I have attached the original test files from JAXB-289 as simple maven project using the maven-jaxb22-plugin. The project contains a default profile to show the output that is undesirable. You can run and inspect using following maven command:

      mvn clean install

      The profile substitutable will just trigger a generation using the annotated schema as per documentation and the Jira issue. You can run this build with following maven command:

      mvn clean install -Psubstitutable

      The exact stack trace error is:

      com.sun.istack.SAXParseException2; systemId: file:///.../base/Model.xsd; lineNumber: 8; columnNumber: 37; compiler was unable to honor this substitutable customization. It is attached to a wrong place, or its inconsistent with other bindings.
      ...
      com.sun.istack.SAXParseException2; systemId: file:///.../base/Model.xsd; lineNumber: 5; columnNumber: 43; (the above customization is attached to the following location in the schema)
      

        Activity

        Hide
        Niels Bertram added a comment -

        Tried to attach the example testcase but have no access. You can find the example on GitHub at https://github.com/bertramn/jaxb-substitutable-example .

        Show
        Niels Bertram added a comment - Tried to attach the example testcase but have no access. You can find the example on GitHub at https://github.com/bertramn/jaxb-substitutable-example .

          People

          • Assignee:
            Iaroslav Savytskyi
            Reporter:
            Niels Bertram
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: