#1181 compilerJs - Rhino vs OpenJDK incompatiblity

katox Fri 20 Aug 2010

Playing with compilerJs::TestRunner I ran into a strange exception:

sys::Err: javax.script.ScriptException: 
             sun.org.mozilla.javascript.EvaluatorException: Encountered code 
             generation error while compiling script: generated bytecode for 
             method exceeds 64K limit.

I googled around a bit and it seems that rhino impl has a soft limit for an internal code optimizer. If this optimization is turned off somehow (setOptimizationLevel(-1) on Context in the original mozilla implementation) the exception doesn't show up.

Strangely, different java implementations use either different rhino versions or just behave differently.

I had no issues with Sun Java 1.6.0_20 but I had on OpenJDK 1.6.18 (and lower). So it is probably best to avoid OpenJDK (installed as default java on Ubuntu). Its compatibility is not great this is not the only problem I had with it.

Writing a note to keep this posted somewhere. Thanks Andy for resolving this annoying issue.

Login or Signup to reply.