sundar@967: /* sundar@967: * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. sundar@967: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. sundar@967: * sundar@967: * This code is free software; you can redistribute it and/or modify it sundar@967: * under the terms of the GNU General Public License version 2 only, as sundar@967: * published by the Free Software Foundation. sundar@967: * sundar@967: * This code is distributed in the hope that it will be useful, but WITHOUT sundar@967: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or sundar@967: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License sundar@967: * version 2 for more details (a copy is included in the LICENSE file that sundar@967: * accompanied this code). sundar@967: * sundar@967: * You should have received a copy of the GNU General Public License version sundar@967: * 2 along with this work; if not, write to the Free Software Foundation, sundar@967: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. sundar@967: * sundar@967: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA sundar@967: * or visit www.oracle.com if you need additional information or have any sundar@967: * questions. sundar@967: */ sundar@967: sundar@967: /** sundar@967: * JDK-8055796: JSObject and browser JSObject linkers should provide fallback to call underlying Java methods directly sundar@967: * sundar@967: * @test sundar@967: * @run sundar@967: */ sundar@967: sundar@967: var m = new javax.script.ScriptEngineManager(); sundar@967: var e = m.getEngineByName("nashorn"); sundar@967: var jsobj = e.eval("({ foo: 33, valueOf: function() 42 })"); sundar@967: sundar@967: print("foo =", jsobj['getMember(java.lang.String)']("foo")); sundar@967: print("eval =", jsobj['eval(String)']("this + 44")); sundar@967: print("valueOf function? =", (jsobj.valueOf)['isFunction()']());