ScriptObjectMirror

Rod Nim rod.nim at outlook.com
Fri Jul 11 07:10:51 UTC 2014


Dear Nashorn devs;
I'm wanting to invoke a JS function that looks like this:
function myFunc(context) {    with(context) {       return a + b;    } } 
Where a and b are values my Java "context" object supplies.
I've tried passing in "context" from Java (via Invocable) as a Map; and am getting:
javax.script.ScriptException: TypeError: Cannot apply "with" to non script object in <eval>
Fair enough. So I tried my own instance of JSObject but Nasorn isn't happy with that either, same exception.
So myArg needs to be an instance of ScriptObjectMirror. But ScriptObjectMirror is final!
Any way to get me out of his corner?
Thank you in advance for your help. I know you're a very busy team and answering "user" questions like this is not a core priority, in fact I almost feel embarrassed to ask.
Thanks again.
Rod 		 	   		  


More information about the nashorn-dev mailing list