RFR(S): 8149334: JSON.parse(JSON.stringify([])).push(10) creates an array containing two elements
Michael Haupt
michael.haupt at oracle.com
Mon Feb 8 11:52:16 UTC 2016
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
--
<http://www.oracle.com/>
Dr. Michael Haupt | Principal Member of Technical Staff
Phone: +49 331 200 7277 | Fax: +49 331 200 7561
Oracle Java Platform Group | LangTools Team | Nashorn
Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany
ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstraße 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603
Komplementärin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Jan Schultheiss, Val Maher
<http://www.oracle.com/commitment> Oracle is committed to developing practices and products that help protect the environment
More information about the nashorn-dev
mailing list