test/script/basic/JDK-8035312_3.js

Tue, 21 Mar 2017 13:41:57 -0700

author
asaha
date
Tue, 21 Mar 2017 13:41:57 -0700
changeset 2160
1df40fe54cd6
parent 1095
3dbb4c9ff43c
permissions
-rw-r--r--

Merge

lagergren@1095 1 /*
lagergren@1095 2 * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
lagergren@1095 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
lagergren@1095 4 *
lagergren@1095 5 * This code is free software; you can redistribute it and/or modify it
lagergren@1095 6 * under the terms of the GNU General Public License version 2 only, as
lagergren@1095 7 * published by the Free Software Foundation.
lagergren@1095 8 *
lagergren@1095 9 * This code is distributed in the hope that it will be useful, but WITHOUT
lagergren@1095 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
lagergren@1095 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
lagergren@1095 12 * version 2 for more details (a copy is included in the LICENSE file that
lagergren@1095 13 * accompanied this code).
lagergren@1095 14 *
lagergren@1095 15 * You should have received a copy of the GNU General Public License version
lagergren@1095 16 * 2 along with this work; if not, write to the Free Software Foundation,
lagergren@1095 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
lagergren@1095 18 *
lagergren@1095 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
lagergren@1095 20 * or visit www.oracle.com if you need additional information or have any
lagergren@1095 21 * questions.
lagergren@1095 22 */
lagergren@1095 23
lagergren@1095 24 /**
lagergren@1095 25 * JDK-8035312_3 - sparse array, non writable length
lagergren@1095 26 *
lagergren@1095 27 * @test
lagergren@1095 28 * @run
lagergren@1095 29 */
lagergren@1095 30
lagergren@1095 31 var b = [1,2,3];
lagergren@1095 32
lagergren@1095 33 Object.defineProperty(b, "length", { writable: false });
lagergren@1095 34 var high = 23534343;
lagergren@1095 35 b[high-10] = high-10;
lagergren@1095 36
lagergren@1095 37 print(b[high-10]);
lagergren@1095 38
lagergren@1095 39 var c = [1,2,3];
lagergren@1095 40 c[high-10] = high-10;
lagergren@1095 41 c.length = 3;
lagergren@1095 42 print(c);
lagergren@1095 43 print(c[high-10]);

mercurial