users@jaxb.java.net

code too large error compiling generated java from xjc

From: Paul Hussein <paul.hussein_at_hapnin.net>
Date: Thu, 12 Apr 2007 15:21:20 +0200

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 ?

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"/>
.............
............