A class not defined error may be displayed when trying to instantiate an object related to an excessively large, thousands of lines, script. The script causes Rhino to generate more Java byte code for a single method or function than is allowed by the Java specification. When Rhino tries to emit a class file for this script, it is unable to do so.
The following are some examples of possible errors that might be displayed to the user:
- Evaluator.evaluateString() problem: java.lang.ArrayIndexOutOfBoundsException
- SEVERE *** ERROR *** Unexpected exception: java.lang.RuntimeException: Program too complex: too big jump offset
- WARNING *** WARNING *** Evaluator: java.lang.RuntimeException: Program too complex: too big jump offset
Steps to Reproduce
- Use a script with a method or function containing a large amount of code. For example, if-else statements and/or switch cases. Either a script include or written directly in the scripts background editor.
- Execute the script through the scripts background editor. Note that Rhino generates more Java byte code than is allowed by the Java specification, and an error message is displayed.
- Note that reducing the size of the script and executing the same line of code, there may no longer be an error message.
- Start by moving the function with the large amount of code to a separate script include.
- If the function continues to be an issue after it is moved to its own file, then refactor it so that it is not one very large switch.
Related Problem: PRB656274