FULL PRODUCT VERSION :
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
OS X version 10.9.5
A DESCRIPTION OF THE PROBLEM :
Executing the following code throws an AssertionError:
new NashornScriptEngineFactory().getScriptEngine().eval("JSON.parse(JSON.stringify([{ '1234': 'fun', '4567': 'fun2' }]));");
REGRESSION. Last worked in version 8u25
ADDITIONAL REGRESSION INFORMATION:
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run this code:
new NashornScriptEngineFactory().getScriptEngine().eval("JSON.parse(JSON.stringify([{ '1234': 'fun', '4567': 'fun2' }]));");
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No exception thrown.
ACTUAL -
An AssertionError is thrown.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.AssertionError
at jdk.nashorn.internal.runtime.arrays.DeletedArrayFilter.delete(DeletedArrayFilter.java:150)
at jdk.nashorn.internal.runtime.arrays.DeletedRangeArrayFilter.delete(DeletedRangeArrayFilter.java:231)
at jdk.nashorn.internal.runtime.ScriptObject.doesNotHaveEnsureDelete(ScriptObject.java:3125)
at jdk.nashorn.internal.runtime.ScriptObject.defineOwnProperty(ScriptObject.java:725)
at jdk.nashorn.internal.runtime.JSONFunctions.setPropertyValue(JSONFunctions.java:200)
at jdk.nashorn.internal.runtime.JSONFunctions.convertNode(JSONFunctions.java:182)
at jdk.nashorn.internal.runtime.JSONFunctions.convertNode(JSONFunctions.java:165)
at jdk.nashorn.internal.runtime.JSONFunctions.parse(JSONFunctions.java:93)
at jdk.nashorn.internal.objects.NativeJSON.parse(NativeJSON.java:105)
at jdk.nashorn.internal.scripts.Script$\^eval\_.:program(<eval>:1)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:387)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:437)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:401)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:397)
at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:152)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
new NashornScriptEngineFactory().getScriptEngine().eval("JSON.parse(JSON.stringify([{ '1234': 'fun', '4567': 'fun2' }]));");
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Don't parse JSON with numbers for keys.