lagergren@1086: /* lagergren@1086: * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. lagergren@1086: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. lagergren@1086: * lagergren@1086: * This code is free software; you can redistribute it and/or modify it lagergren@1086: * under the terms of the GNU General Public License version 2 only, as lagergren@1086: * published by the Free Software Foundation. lagergren@1086: * lagergren@1086: * This code is distributed in the hope that it will be useful, but WITHOUT lagergren@1086: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or lagergren@1086: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License lagergren@1086: * version 2 for more details (a copy is included in the LICENSE file that lagergren@1086: * accompanied this code). lagergren@1086: * lagergren@1086: * You should have received a copy of the GNU General Public License version lagergren@1086: * 2 along with this work; if not, write to the Free Software Foundation, lagergren@1086: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. lagergren@1086: * lagergren@1086: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA lagergren@1086: * or visit www.oracle.com if you need additional information or have any lagergren@1086: * questions. lagergren@1086: */ lagergren@1086: lagergren@1086: /** lagergren@1086: * JDK-8057825 : A failed apply to call generation should NOT reuse the lagergren@1086: * best apply to call generation so far - because it may not fit!!! lagergren@1086: * lagergren@1086: * @test lagergren@1086: * @run lagergren@1086: */ lagergren@1086: lagergren@1086: function createApplier(f) { lagergren@1086: function applier() { lagergren@1086: f.apply(this, arguments); // no transform applied here lagergren@1086: } lagergren@1086: return applier; lagergren@1086: } lagergren@1086: lagergren@1086: function printer(x,y) { lagergren@1086: print(x + " and " + y); lagergren@1086: } lagergren@1086: lagergren@1086: var printerApplier = createApplier(printer); lagergren@1086: printerApplier(); lagergren@1086: printerApplier.apply(this, ["foo", "bar"]);