RFR(S): 8149334: JSON.parse(JSON.stringify([])).push(10) creates an array containing two elements
Sundararajan Athijegannathan
sundararajan.athijegannathan at oracle.com
Mon Feb 8 12:37:25 UTC 2016
+1
On 2/8/2016 5:22 PM, Michael Haupt wrote:
> Dear all,
>
> please review this fix.
> Bug: https://bugs.openjdk.java.net/browse/JDK-8149334
> Webrev: http://cr.openjdk.java.net/~mhaupt/8149334/webrev.00
>
> The problem here is that the transition from an immutable empty array (of the internal type ArrayData.UntouchedArrayData) to an array containing actual data would create an array with one entry before then appending the pushed element. The fix is to return an actually empty (if mutable) ArrayData instance in these cases.
>
> Tested in 9-dev and 8u. As this was filed against 8u60, it will be backported.
>
> Thanks,
>
> Michael
>
More information about the nashorn-dev
mailing list