highsource / highsource/jaxb2-basics
simplify: generating erroneous List properties instead of simple objects
- Dominant language
- Java
- Stars
- 119
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
Please check this small project: https://github.com/sfrenkiel/basicstest. It contains this xsd:
If you run the pom and look at the generated class Wrapper.java, you'll see that all the properties are generated as lists of objects, not simple objects:
public class Wrapper {
protected List element;
protected List twoA;
protected List oneA;
protected List b;
...
There are 3 xsd files in the project. If you replace the contents of test.xsd with either works1.xsd or works2.xsd, and rerun maven, you'll see that Wrapper.java is generated as expected:
public class Wrapper {
@XmlElement(required = true)
protected Object element;
protected Object oneA;
protected Object b;
...
I suspect having element 'b' appear twice under the Wrapper hierarchy is causing the issue, although as 'b' only appears under separate elements within a 'choice' construct I don't believe this should be happening. Worse though is that this seems to cause the other properties to be generated as lists as well.
BTW, wrapping seq1 and seq2 in complexTypes also resolves the problem, however this approach isn't possible in the actual code I am working with.
Any insight is appreciated. Thanks!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.