Re: ScriptFunction being passed to JSObject, expected ScriptObjectMirror

2017-08-30 Thread Jesse Schulman
Thanks for advising on how to best get undefined. For the bug you opened I have worked around it for now by calling ScriptUtil.wrap() when we get a ScriptFunction to turn it into a ScriptObjectMirror. I will track the issue at the URL you shared and remove the ScriptUtil.wrap call once it's fixed

Re: ScriptFunction being passed to JSObject, expected ScriptObjectMirror

2017-08-28 Thread Sundararajan Athijegannathan
I think you can do something like this: import javax.script.*; import jdk.nashorn.api.scripting.JSObject; public class Main { public static void main(String[] args) throws Exception { ScriptEngineManager m = new ScriptEngineManager(); ScriptEngine e = m.getEngineByName("nashorn");

Re: ScriptFunction being passed to JSObject, expected ScriptObjectMirror

2017-08-28 Thread Jesse Schulman
Awesome, thanks for the quick response! On a somewhat related note, what is the proper way of returning 'undefined' from a JSObject implementation? I have seen it work various ways but when I have tested our application on the jdk9 beta releases I have had to take a different approach than Undefi

Re: ScriptFunction being passed to JSObject, expected ScriptObjectMirror

2017-08-27 Thread Sundararajan Athijegannathan
Hi, Thanks for the standalone test case! I reproduced the issue and filed a bug -> https://bugs.openjdk.java.net/browse/JDK-8186807 Thanks, -Sundar On 24/08/17, 11:11 PM, Jesse Schulman wrote: The type is ScriptFunction, I've created a simple reproducer that I've pushed to https://github.co

Re: ScriptFunction being passed to JSObject, expected ScriptObjectMirror

2017-08-24 Thread Jesse Schulman
The type is ScriptFunction, I've created a simple reproducer that I've pushed to https://github.com/jesseschulman/JSObject_gets_ScriptFunction Thanks! Jesse On Thu, Aug 24, 2017 at 1:05 AM Sundararajan Athijegannathan < sundarara

Re: ScriptFunction being passed to JSObject, expected ScriptObjectMirror

2017-08-24 Thread Sundararajan Athijegannathan
what is the type of args[0]? Can you print args[0].getClass() to check it? Thanks, -Sundar On 24/08/17, 9:14 AM, Jesse Schulman wrote: I did try running with -Dnashorn.apply2call=false when I saw the email for that fix but it did not resolve the issue. There is no exception thrown, but our JS

Re: ScriptFunction being passed to JSObject, expected ScriptObjectMirror

2017-08-23 Thread Jesse Schulman
I did try running with -Dnashorn.apply2call=false when I saw the email for that fix but it did not resolve the issue. There is no exception thrown, but our JSObject.call method basically is no-op as a result of not getting a ScriptObjectMirror, it effectively looks like this: @Override

Re: ScriptFunction being passed to JSObject, expected ScriptObjectMirror

2017-08-23 Thread Sundararajan Athijegannathan
Hi, Sorry for the delayed response. We need more info to debug this - in particular, what is the exception (if any) thrown etc. I wonder if this is related to this recent apply-related fix -> http://mail.openjdk.java.net/pipermail/nashorn-dev/2017-August/006998.html -Sundar On 22/08/17, 3:4