lagergren@1097: /* lagergren@1097: * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. lagergren@1097: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. lagergren@1097: * lagergren@1097: * This code is free software; you can redistribute it and/or modify it lagergren@1097: * under the terms of the GNU General Public License version 2 only, as lagergren@1097: * published by the Free Software Foundation. lagergren@1097: * lagergren@1097: * This code is distributed in the hope that it will be useful, but WITHOUT lagergren@1097: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or lagergren@1097: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License lagergren@1097: * version 2 for more details (a copy is included in the LICENSE file that lagergren@1097: * accompanied this code). lagergren@1097: * lagergren@1097: * You should have received a copy of the GNU General Public License version lagergren@1097: * 2 along with this work; if not, write to the Free Software Foundation, lagergren@1097: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. lagergren@1097: * lagergren@1097: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA lagergren@1097: * or visit www.oracle.com if you need additional information or have any lagergren@1097: * questions. lagergren@1097: */ lagergren@1097: lagergren@1097: /** lagergren@1097: * JDK-8062937 - GlobalConstants produces wrong result with defineProperty and index setters lagergren@1097: * lagergren@1097: * @test lagergren@1097: * @run lagergren@1097: */ lagergren@1097: lagergren@1097: var x = 1; lagergren@1097: for (var i = 2; i < 5; i++) { lagergren@1097: print(x); lagergren@1097: Object.defineProperty(this, "x", {value: i}); lagergren@1097: } lagergren@1097: print(x); lagergren@1097: lagergren@1097: print(); lagergren@1097: lagergren@1097: var name = "y"; lagergren@1097: var y = 1; lagergren@1097: for (var i = 2; i < 5; i++) { lagergren@1097: print(y); lagergren@1097: this[name] = i; lagergren@1097: } lagergren@1097: print(y);