how to import long from java into polyglot => java.lang.Long cannot be cast to com.oracle.truffle.api.interop.TruffleObject [was Re: Graal embed documentation not in place]

Jaroslav Tulach jaroslav.tulach at oracle.com
Tue Aug 8 12:34:59 UTC 2017


On úterý 8. srpna 2017 11:54:17 CEST Jerven Tjalling Bolleman wrote:
> Hi All,
> 
> Next question, How can I import a java.lang.Long into the js space
> inside the context. I am now working around it by passing it in as a
> parameter e.g.
> 
> Value function = context.eval("js", "function(x,out){out.print(x)}");
> function.execute(out, 1000_000_000_000L);
> 
> Works
> 
> However,
> 
> context.exportSymbol("x",1000_000_000_000L);
> context.exportSymbol("out", response.getOutoutStream());
> Value function = context.eval("js",
> "x=Interop.import('x');out=Interop.import('out);out.print(x)");
> 
> Does not with the following exception.
> 
> java.lang.Long cannot be cast to
> com.oracle.truffle.api.interop.TruffleObject

What's the stacktrace?
-jt

PS: What version are you using?



More information about the graal-dev mailing list