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