The following code throws ArrayIndexOutOfBoundsException with JDK9 with optimistic types enabled: var m = 1; var obj = { p0: m, p1: m = "foo", p2: m }; Appearently the restof handle expects a second copy of the JD4 object being initialized on the stack which is not available in the RewriteException's stack array. The object literal code is generated by FieldObjectCreator, but SpillObjectCreator (used for object literals with >= 256 properties) exhibits the same problem. Output: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4 at jdk.nashorn.internal.scripts.Script$Recompilation$2$JDK_8078049$cu1$restOf.:program(test/script/basic/JDK-8078049.js:0) at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636) at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:228) at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393) at jdk.nashorn.tools.Shell.apply(Shell.java:397) at jdk.nashorn.tools.Shell.runScripts(Shell.java:326) at jdk.nashorn.tools.Shell.run(Shell.java:172) at jdk.nashorn.tools.Shell.main(Shell.java:136) at jdk.nashorn.tools.Shell.main(Shell.java:112)
|