Re: RFR(S): 8149334: JSON.parse(JSON.stringify([])).push(10) creates an array containing two elements

2016-02-08 Thread Jim Laskey (Oracle)
+1

> On Feb 8, 2016, at 7:52 AM, 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
> 
> -- 
> 
> 
> 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
> Oracle is committed to developing 
> practices and products that help protect the environment
> 



Re: RFR(S): 8149334: JSON.parse(JSON.stringify([])).push(10) creates an array containing two elements

2016-02-08 Thread Sundararajan Athijegannathan

+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





RFR(S): 8149334: JSON.parse(JSON.stringify([])).push(10) creates an array containing two elements

2016-02-08 Thread Michael Haupt
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

-- 

 
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
  Oracle is committed to developing 
practices and products that help protect the environment