I have 1.5MB of JavaScript that runs just fine in Rhino's compiled loading mode. When I minimize the JavaScript using something like Dojo's ShrinkSafe, then give the shrunken script to Rhino 1.6r6, it throws a " Exception in thread "main" java.lang.IllegalArgumentException?: out of range index" exception. The full-size script that has not been minimized has no problems. I know this is a problem with the minimizer I'm using, but I don't know how to go about tracking down the precise region of JavaScript causing the problem.
The stack trace looks exactly like the one listed here: http://trac.dojotoolkit.org/ticket/2896. Line for line it's the same. In that bug report, the problem was listed as being the size of the script. However since Rhino handles the JS file that is twice as large as the one that is not shrunken, I'm guessing that size is not as important as content in this case. $ java -jar js-1_6R6pre.jar my-full-sized.js # yay! no exceptions $ java -jar js-1_7R1pre.jar my-shrunken.js # yay! no exceptions $ java -jar js-1_6R6pre.jar my-shrunken.js Exception in thread "main" java.lang.IllegalArgumentException: out of range index at org.mozilla.classfile.ClassFileWriter.add(ClassFileWriter.java:542) at org.mozilla.classfile.ClassFileWriter.addLoadConstant(ClassFileWriter.java: 602) at org.mozilla.classfile.ClassFileWriter.addPush(ClassFileWriter.java: 838) at org.mozilla.javascript.optimizer.Codegen.generateNativeFunctionOverrides(Codegen.java: 851) at org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java: 276) at org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java: 161) at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:71) at org.mozilla.javascript.Context.compileImpl(Context.java: 2349) at org.mozilla.javascript.Context.compileString(Context.java: 1354) at org.mozilla.javascript.Context.compileString(Context.java: 1343) at org.mozilla.javascript.tools.shell.Main.loadScriptFromSource(Main.java: 455) at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java: 443) at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:412) at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:403) at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:179) at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java: 100) at org.mozilla.javascript.Context.call(Context.java:583) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:506) at org.mozilla.javascript.tools.shell.Main.exec(Main.java:162) at org.mozilla.javascript.tools.shell.Main.main(Main.java:140) _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
