test/script/basic/JDK-8055796.js

Tue, 21 Mar 2017 13:41:57 -0700

author
asaha
date
Tue, 21 Mar 2017 13:41:57 -0700
changeset 2160
1df40fe54cd6
parent 969
e94c247e4673
permissions
-rw-r--r--

Merge

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

mercurial