Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xjc generates duplicated 'create' methods in ObjectFactory when using episode file #1729

Open
patric-r opened this issue Aug 9, 2023 · 1 comment

Comments

@patric-r
Copy link

patric-r commented Aug 9, 2023

Hi there,

We have a rather complex set of schema files.
The schema files can be grouped into 2 parts, one generic part A and one specific part B which reuses types from A.

As always, we use xjc to generate jaxb classes for part A and let xjc generate an episode file.
When generating the jaxb classes for part B we used that episode file in order to avoid duplicate class creation which works perfectly.

However, when looking into the ObjectFactory of part B, it suprisingly contains create methods for classes of part A and those create methods are already part of the ObjectFactory of part A.

As a result, when marshalling our JAXB tree, it fails with:

java.util.concurrent.CompletionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 3 counts of IllegalAnnotationExceptions
The element name {http://namespace/of/part/A has more than one mapping.
    this problem is related to the following location:
at public javax.xml.bind.JAXBElement com.part.B.xml.ObjectFactory.createProblematicType(com.part.A.xml.ProblematicType)

When manually removing those redudant create methods from part B's ObjectFactory, everything works as expected.

Question:
Why does xjc create those duplicate create() methods?

(Note: jaxb 2.3.5 has been used)

@laurentschoelens
Copy link
Contributor

Hi @patric-r

Could you test with latest jaxb 2.3.8 release and say if this solve your issue ?

What tool do you use to generate java files from schema ?

Thanks for your responses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants