Menu

#104 Generated code too large

pending
5
2011-07-18
2011-07-05
Tom Smith
No

For some machines with a large number of states/transitions, compiling the generated Java code yields a "Code too large" error. See attached code for example.

Test.java:12: code too large
private static State[] Test_states = new State[Test_NUM_STATES];
^
1 error

Discussion

  • Tom Smith

    Tom Smith - 2011-07-05

    .ech and .java file resulting in compile error

     
  • Tom Smith

    Tom Smith - 2011-07-05

    Eric located this documentation of the class file limits.

    http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html

    It appears that the code in the static initializers is the problem. Breaking this code up into smaller static methods and calling the methods from the initializer allows the code to compile. The inefficiency should be minimal since it only occurs at class initialization time.

    See attached version of Test.java, modified by hand.

     
  • Tom Smith

    Tom Smith - 2011-07-05

    hand-modified version of generated code

     
  • Gregory W Bond

    Gregory W Bond - 2011-07-18

    submitted fix to SVN: rev 1802

     
  • Gregory W Bond

    Gregory W Bond - 2011-07-18
    • status: open --> pending
     

Log in to post a comment.