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