jaxb-tools icon indicating copy to clipboard operation
jaxb-tools copied to clipboard

jaxb:typesafeEnumClass doesn't play nice with episode based projects

Open samhendley opened this issue 9 years ago • 3 comments

I have been struggling to get episode based compilation to work on an existing codebase. Using these samples I have been able to get most of the way then ran into this show stopper with enum values. I was able to replicate this in your sample projects. Basically it looks like there is some sort of issue with including the typesafeEnumClass in some cases. In particular I ran into this issue with an integer enum class but it appears to be occur if you use both typesafeEnumClass and typesafeEnumMember on a string enum.

I think the "default bindings" may somehow related but I am out of my depth on how I would go about fixing this. If there is a simple solution it wouldn't be a bad idea to add to sample project.

Thanks for your hard work on this plugin, having samples and tests made it infinitely easier for me to boil down by use case to this minimal reproduction case. Happy New Year!

Errors are:

[ERROR] Error while parsing schema(s).Location [ https://maven-jaxb2-plugin.dev.java.net/svn/maven-jaxb2-plugin/trunk/samples/episode/a/src/main/resources/a.xsd{66,30}].
com.sun.istack.SAXParseException2; systemId: https://maven-jaxb2-plugin.dev.java.net/svn/maven-jaxb2-plugin/trunk/samples/episode/a/src/main/resources/a.xsd; lineNumber: 66; columnNumber: 30; compiler was unable to honor this enum customization. It is attached to a wrong place, or its inconsistent with other bindings.
    at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:86)
    at com.sun.tools.xjc.reader.xmlschema.ErrorReporter.error(ErrorReporter.java:84)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.check(UnusedCustomizationChecker.java:149)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.check(UnusedCustomizationChecker.java:127)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.simpleType(UnusedCustomizationChecker.java:240)
    at com.sun.xml.xsom.impl.SimpleTypeImpl.visit(SimpleTypeImpl.java:164)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.run(UnusedCustomizationChecker.java:113)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.run(UnusedCustomizationChecker.java:107)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder._build(BGMBuilder.java:181)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.build(BGMBuilder.java:119)
    at com.sun.tools.xjc.ModelLoader.annotateXMLSchema(ModelLoader.java:425)
    at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:174)
    at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:119)
    at org.jvnet.mjiip.v_2_2.XJC22Mojo.loadModel(XJC22Mojo.java:50)
    at org.jvnet.mjiip.v_2_2.XJC22Mojo.doExecute(XJC22Mojo.java:40)
    at org.jvnet.mjiip.v_2_2.XJC22Mojo.doExecute(XJC22Mojo.java:28)
    at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:505)
    at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:328)
    at ...
[ERROR] Error while parsing schema(s).Location [ https://maven-jaxb2-plugin.dev.java.net/svn/maven-jaxb2-plugin/trunk/samples/episode/a/src/main/resources/a.xsd{62,36}].
com.sun.istack.SAXParseException2; systemId: https://maven-jaxb2-plugin.dev.java.net/svn/maven-jaxb2-plugin/trunk/samples/episode/a/src/main/resources/a.xsd; lineNumber: 62; columnNumber: 36; (the above customization is attached to the following location in the schema)
    at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:86)
    at com.sun.tools.xjc.reader.xmlschema.ErrorReporter.error(ErrorReporter.java:84)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.check(UnusedCustomizationChecker.java:154)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.check(UnusedCustomizationChecker.java:127)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.simpleType(UnusedCustomizationChecker.java:240)
    at com.sun.xml.xsom.impl.SimpleTypeImpl.visit(SimpleTypeImpl.java:164)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.run(UnusedCustomizationChecker.java:113)
    at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.run(UnusedCustomizationChecker.java:107)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder._build(BGMBuilder.java:181)
    at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.build(BGMBuilder.java:119)
    at com.sun.tools.xjc.ModelLoader.annotateXMLSchema(ModelLoader.java:425)
    at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:174)
    at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:119)
    at org.jvnet.mjiip.v_2_2.XJC22Mojo.loadModel(XJC22Mojo.java:50)
    at org.jvnet.mjiip.v_2_2.XJC22Mojo.doExecute(XJC22Mojo.java:40)
    at org.jvnet.mjiip.v_2_2.XJC22Mojo.doExecute(XJC22Mojo.java:28)
    at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:505)
    at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:328)
    at ...

samhendley avatar Dec 31 '15 00:12 samhendley

It would be really helpful if this was fixed.

m120miller avatar Jan 19 '16 13:01 m120miller

Should I rework this as a https://github.com/highsource/maven-jaxb2-plugin-support issue?

samhendley avatar Feb 01 '16 18:02 samhendley

Hi,

no, not necessary. I've just a bit to much stress at work, don't come to OS things.

Best wishes, Alexey

highsource avatar Feb 01 '16 18:02 highsource