hannesw@1125: /* hannesw@1125: * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. hannesw@1125: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. hannesw@1125: * hannesw@1125: * This code is free software; you can redistribute it and/or modify it hannesw@1125: * under the terms of the GNU General Public License version 2 only, as hannesw@1125: * published by the Free Software Foundation. hannesw@1125: * hannesw@1125: * This code is distributed in the hope that it will be useful, but WITHOUT hannesw@1125: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or hannesw@1125: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License hannesw@1125: * version 2 for more details (a copy is included in the LICENSE file that hannesw@1125: * accompanied this code). hannesw@1125: * hannesw@1125: * You should have received a copy of the GNU General Public License version hannesw@1125: * 2 along with this work; if not, write to the Free Software Foundation, hannesw@1125: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. hannesw@1125: * hannesw@1125: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA hannesw@1125: * or visit www.oracle.com if you need additional information or have any hannesw@1125: * questions. hannesw@1125: */ hannesw@1125: hannesw@1125: /** hannesw@1125: * JDK-8066932: __noSuchMethod__ binds to this-object without proper guard hannesw@1125: * hannesw@1125: * @test hannesw@1125: * @run hannesw@1125: */ hannesw@1125: hannesw@1125: function C(id) { hannesw@1125: this.id = id; hannesw@1125: } hannesw@1125: hannesw@1125: C.prototype.__noSuchMethod__ = function(name, args) { hannesw@1125: return this.id; hannesw@1125: }; hannesw@1125: hannesw@1125: function test(id) { hannesw@1125: var c = new C(id); hannesw@1125: return c.nonExistingMethod(); hannesw@1125: } hannesw@1125: hannesw@1125: for (var i = 0; i < 30; i++) { hannesw@1125: if (test(i) !== i) { hannesw@1125: throw new Error("Wrong result from noSuchMethod in iteration " + i); hannesw@1125: } hannesw@1125: }