test/script/basic/JDK-8066932.js

Wed, 28 Jan 2015 17:58:08 +0100

author
attila
date
Wed, 28 Jan 2015 17:58:08 +0100
changeset 1226
8b3f832bea55
parent 1125
fef78bb8752b
permissions
-rw-r--r--

8067139: Finally blocks inlined incorrectly
Reviewed-by: hannesw, lagergren

hannesw@1125 1 /*
hannesw@1125 2 * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
hannesw@1125 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hannesw@1125 4 *
hannesw@1125 5 * This code is free software; you can redistribute it and/or modify it
hannesw@1125 6 * under the terms of the GNU General Public License version 2 only, as
hannesw@1125 7 * published by the Free Software Foundation.
hannesw@1125 8 *
hannesw@1125 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hannesw@1125 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hannesw@1125 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hannesw@1125 12 * version 2 for more details (a copy is included in the LICENSE file that
hannesw@1125 13 * accompanied this code).
hannesw@1125 14 *
hannesw@1125 15 * You should have received a copy of the GNU General Public License version
hannesw@1125 16 * 2 along with this work; if not, write to the Free Software Foundation,
hannesw@1125 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hannesw@1125 18 *
hannesw@1125 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hannesw@1125 20 * or visit www.oracle.com if you need additional information or have any
hannesw@1125 21 * questions.
hannesw@1125 22 */
hannesw@1125 23
hannesw@1125 24 /**
hannesw@1125 25 * JDK-8066932: __noSuchMethod__ binds to this-object without proper guard
hannesw@1125 26 *
hannesw@1125 27 * @test
hannesw@1125 28 * @run
hannesw@1125 29 */
hannesw@1125 30
hannesw@1125 31 function C(id) {
hannesw@1125 32 this.id = id;
hannesw@1125 33 }
hannesw@1125 34
hannesw@1125 35 C.prototype.__noSuchMethod__ = function(name, args) {
hannesw@1125 36 return this.id;
hannesw@1125 37 };
hannesw@1125 38
hannesw@1125 39 function test(id) {
hannesw@1125 40 var c = new C(id);
hannesw@1125 41 return c.nonExistingMethod();
hannesw@1125 42 }
hannesw@1125 43
hannesw@1125 44 for (var i = 0; i < 30; i++) {
hannesw@1125 45 if (test(i) !== i) {
hannesw@1125 46 throw new Error("Wrong result from noSuchMethod in iteration " + i);
hannesw@1125 47 }
hannesw@1125 48 }

mercurial