I had this problem once before, and there was a workaround back then, however I was hoping this would have been fixed by now as it was quite a while ago and the script I am having trouble with this time is already broken up a LOT into "blocks" and lots of def "xxx" = functions to try and prevent this happening. I can't see a way to break it up further as it is far from a "normal" linear script where this is easy ("run part 1, run part 2, etc.").
The error:
Code:
Error in simulation (maybe not a real error) org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during class generation: Method code too large!
java.lang.RuntimeException: Method code too large!
at org.objectweb.asm.MethodWriter.a(Unknown Source)
at org.objectweb.asm.ClassWriter.toByteArray(Unknown Source)
at org.codehaus.groovy.control.CompilationUnit$14.call(CompilationUnit.java:788)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1027)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:564)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:542)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:519)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:244)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:202)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:212)
at ss.desktop.EditorFrame.threadedTest(EditorFrame.java:900)
at ss.desktop.EditorFrame.access$24(EditorFrame.java:892)
at ss.desktop.EditorFrame$32.run(EditorFrame.java:871)
Of course the biggest problem is that the above gives me no idea what I need to fix, unless this is really still a hardcoded "script size" limit. Right now, the script stands at 9546 lines of code and the file is 268kb.
Worryingly, it seems that removing any 25 lines or so of code "fixes" the error (I also note this drops the file size to 268kb). I was thinking I just had a function that was way too long (there are a couple of those) and I could find a way to trim them down more efficiently, but the fact that just making the file a bit smaller by removing any random code (as long as the missing code doesn't cause an error) makes me worried I in fact have no coding errors but it is a "file size" issue that is causing this!
PLEASE tell me this is fixable, as I've been working on this very special script literally for several *years* now and the idea it could have all been a waste of time due to code limits meaning I'd never being able to finish it (since it still needs another thousand lines of code or so) makes me want to curl up and cry!