users@jaxb.java.net

Re: code too large error compiling generated java from xjc

From: Paul Hussein <paul.hussein_at_hapnin.net>
Date: Thu, 12 Apr 2007 22:01:37 +0200

Thanks for the hint!

Is this still a feature then in jaxb2 as in jaxb1 that if the
enumeration is large then the code generated will be too large, and
the only way round is as below, or is there some other way ?

Thanks

Paul.

On 4/12/07, Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_sun.com> wrote:
> Paul Hussein wrote:
> > Hi,
> >
> > I have a schema which has a simple type which is an enumeration of a
> > lrge number of strings. When I put through XJC to generate the java
> > objects, and then I compile the generated source, I get 'code too
> > large'
> >
> > Can I switch off generation of the enum class, and use a string ?
>
> Yes. Use <globalBindings typesafeEnumMaxMembers="100" /> to avoid
> generating enums if there are more than 100 constants, etc. There are
> other ways to enable/disable, but for your case this should work fine.
>
> I just realized that we don't have a published the schema of the binding
> customizations. I should really do that.
>
> >
> > How can I generate code that has smaller elements. I see in the src
> >
> > if(qnameMap.size()>1024)
> > // stop gap measure to avoid 'code too large' error in javac.
> > return createQName(name);
> >
> > That some attempt has been made to fix this, but how do I get it to work ?
> >
> > Thanks
> >
> > Paul.
> >
> > e.g.
> >
> > generate-sources:
> > [xjc] Consider using <depends>/<produces> so that XJC won't do
> > unnecessary compilation
> > [xjc] Compiling
> > file:/home/hussepa/network/development/schemas/datacollection.xsd
> > [xjc] removing old output files
> > [xjc] Writing output to /home/hussepa/network/development/generated-src
> >
> > compile:
> > [javac] Compiling 46 source files to /home/hussepa/network/development/build
> > [javac] /home/hussepa/network/development/generated-src/it/jrc/ipsc/fish/datacollection/schema/SpeciesType.java:10686:
> > code too large
> > [javac] @XmlEnumValue("OTHER")
> > [javac] ^
> > [javac] 1 error
> >
> >
> >
> >
> >
> >
> >
> >
> > ----------------------------
> >
> >
> > Start of xsd
> >
> > <?xml version='1.0' encoding='UTF-8'?>
> > <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'
> > elementFormDefault='qualified'>
> > <xs:simpleType name='species_type'>
> > <xs:restriction base='xs:string'>
> > <xs:enumeration value='OTHER'/>
> > <xs:enumeration value='UNKNOWN'/>
> > <xs:enumeration value="3A_CODE"/>
> > <xs:enumeration value="LAU"/>
> > <xs:enumeration value="LAR"/>
> > <xs:enumeration value="LAO"/>
> > <xs:enumeration value="LAY"/>
> > <xs:enumeration value="LAF"/>
> > <xs:enumeration value="LAE"/>
> > ............
> > ...........
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >
> >
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>