eclipse-ee4j / jaxb-ri

Jaxb RI
https://eclipse-ee4j.github.io/jaxb-ri/
BSD 3-Clause "New" or "Revised" License
205 stars 111 forks source link

XJC: "trying to create the same field twice" possibly ignores case #827

Open Tomas-Kraus opened 13 years ago

Tomas-Kraus commented 13 years ago

Trace:

Exception in thread "main" java.lang.IllegalArgumentException: trying to create the same field twice: ts1EnbDirectInfoTransferTrir at com.sun.codemodel.JDefinedClass.field(JDefinedClass.java:421) at com.sun.codemodel.JDefinedClass.field(JDefinedClass.java:392) at com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar.createField(AbstractFieldWithVar.java:77) at com.sun.tools.xjc.generator.bean.field.SingleField.(SingleField.java:94) at com.sun.tools.xjc.generator.bean.field.SingleField.(SingleField.java:81) at sun.reflect.GeneratedConstructorAccessor8.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.sun.tools.xjc.generator.bean.field.GenericFieldRenderer.generate(GenericFieldRenderer.java:69) at com.sun.tools.xjc.generator.bean.field.DefaultFieldRenderer.generate(DefaultFieldRenderer.java:84) at com.sun.tools.xjc.generator.bean.BeanGenerator.generateFieldDecl(BeanGenerator.java:764) at com.sun.tools.xjc.generator.bean.BeanGenerator.generateClassBody(BeanGenerator.java:545) at com.sun.tools.xjc.generator.bean.BeanGenerator.(BeanGenerator.java:248) at com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:166) at com.sun.tools.xjc.model.Model.generateCode(Model.java:290) at com.sun.tools.xjc.Driver.run(Driver.java:348) at com.sun.tools.xjc.Driver.run(Driver.java:196) at com.sun.tools.xjc.Driver._main(Driver.java:121) at com.sun.tools.xjc.Driver.access$000(Driver.java:79) at com.sun.tools.xjc.Driver$1.run(Driver.java:101)

In XML I have two fields with the same name, but the are in different cases, which is legal:

<xsd:element name="ts1EnbDirectInfoTransferTrir" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:int">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="10000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="tS1EnbDirectInfoTransferTrir" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:int">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="10000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>

Environment

Ubuntu 10.04.2 LTS, NFS mount

Affected Versions

[2.2.3]

Tomas-Kraus commented 6 years ago
Tomas-Kraus commented 13 years ago

@glassfishrobot Commented Reported by wargoth

Tomas-Kraus commented 13 years ago

@glassfishrobot Commented wargoth said: When I comment out the second field, it compiles fine

Tomas-Kraus commented 13 years ago

@glassfishrobot Commented snajper said: customization can be used for such cases, but will look into how to prevent this automatically

Tomas-Kraus commented 13 years ago

@glassfishrobot Commented Was assigned to snajper

Tomas-Kraus commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-827